aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--fs/Kconfig8
-rw-r--r--fs/ufs/balloc.c62
-rw-r--r--fs/ufs/cylinder.c31
-rw-r--r--fs/ufs/dir.c28
-rw-r--r--fs/ufs/ialloc.c22
-rw-r--r--fs/ufs/inode.c47
-rw-r--r--fs/ufs/namei.c21
-rw-r--r--fs/ufs/super.c114
-rw-r--r--fs/ufs/truncate.c30
-rw-r--r--fs/ufs/util.c9
-rw-r--r--include/linux/ufs_fs.h13
11 files changed, 168 insertions, 217 deletions
diff --git a/fs/Kconfig b/fs/Kconfig
index c0afaccad609..ea60e83e7fed 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1375,6 +1375,14 @@ config UFS_FS_WRITE
1375 Say Y here if you want to try writing to UFS partitions. This is 1375 Say Y here if you want to try writing to UFS partitions. This is
1376 experimental, so you should back up your UFS partitions beforehand. 1376 experimental, so you should back up your UFS partitions beforehand.
1377 1377
1378config UFS_DEBUG
1379 bool "UFS debugging"
1380 depends on UFS_FS
1381 help
1382 If you are experiencing any problems with the UFS filesystem, say
1383 Y here. This will result in _many_ additional debugging messages to be
1384 written to the system log.
1385
1378endmenu 1386endmenu
1379 1387
1380menu "Network File Systems" 1388menu "Network File Systems"
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 343eaf4542f8..7a4735f591bc 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -21,14 +21,6 @@
21#include "swab.h" 21#include "swab.h"
22#include "util.h" 22#include "util.h"
23 23
24#undef UFS_BALLOC_DEBUG
25
26#ifdef UFS_BALLOC_DEBUG
27#define UFSD(x) printk("(%s, %d), %s:", __FILE__, __LINE__, __FUNCTION__); printk x;
28#else
29#define UFSD(x)
30#endif
31
32static unsigned ufs_add_fragments (struct inode *, unsigned, unsigned, unsigned, int *); 24static unsigned ufs_add_fragments (struct inode *, unsigned, unsigned, unsigned, int *);
33static unsigned ufs_alloc_fragments (struct inode *, unsigned, unsigned, unsigned, int *); 25static unsigned ufs_alloc_fragments (struct inode *, unsigned, unsigned, unsigned, int *);
34static unsigned ufs_alloccg_block (struct inode *, struct ufs_cg_private_info *, unsigned, int *); 26static unsigned ufs_alloccg_block (struct inode *, struct ufs_cg_private_info *, unsigned, int *);
@@ -52,7 +44,7 @@ void ufs_free_fragments(struct inode *inode, unsigned fragment, unsigned count)
52 uspi = UFS_SB(sb)->s_uspi; 44 uspi = UFS_SB(sb)->s_uspi;
53 usb1 = ubh_get_usb_first(uspi); 45 usb1 = ubh_get_usb_first(uspi);
54 46
55 UFSD(("ENTER, fragment %u, count %u\n", fragment, count)) 47 UFSD("ENTER, fragment %u, count %u\n", fragment, count);
56 48
57 if (ufs_fragnum(fragment) + count > uspi->s_fpg) 49 if (ufs_fragnum(fragment) + count > uspi->s_fpg)
58 ufs_error (sb, "ufs_free_fragments", "internal error"); 50 ufs_error (sb, "ufs_free_fragments", "internal error");
@@ -123,12 +115,12 @@ void ufs_free_fragments(struct inode *inode, unsigned fragment, unsigned count)
123 sb->s_dirt = 1; 115 sb->s_dirt = 1;
124 116
125 unlock_super (sb); 117 unlock_super (sb);
126 UFSD(("EXIT\n")) 118 UFSD("EXIT\n");
127 return; 119 return;
128 120
129failed: 121failed:
130 unlock_super (sb); 122 unlock_super (sb);
131 UFSD(("EXIT (FAILED)\n")) 123 UFSD("EXIT (FAILED)\n");
132 return; 124 return;
133} 125}
134 126
@@ -148,7 +140,7 @@ void ufs_free_blocks(struct inode *inode, unsigned fragment, unsigned count)
148 uspi = UFS_SB(sb)->s_uspi; 140 uspi = UFS_SB(sb)->s_uspi;
149 usb1 = ubh_get_usb_first(uspi); 141 usb1 = ubh_get_usb_first(uspi);
150 142
151 UFSD(("ENTER, fragment %u, count %u\n", fragment, count)) 143 UFSD("ENTER, fragment %u, count %u\n", fragment, count);
152 144
153 if ((fragment & uspi->s_fpbmask) || (count & uspi->s_fpbmask)) { 145 if ((fragment & uspi->s_fpbmask) || (count & uspi->s_fpbmask)) {
154 ufs_error (sb, "ufs_free_blocks", "internal error, " 146 ufs_error (sb, "ufs_free_blocks", "internal error, "
@@ -215,12 +207,12 @@ do_more:
215 207
216 sb->s_dirt = 1; 208 sb->s_dirt = 1;
217 unlock_super (sb); 209 unlock_super (sb);
218 UFSD(("EXIT\n")) 210 UFSD("EXIT\n");
219 return; 211 return;
220 212
221failed: 213failed:
222 unlock_super (sb); 214 unlock_super (sb);
223 UFSD(("EXIT (FAILED)\n")) 215 UFSD("EXIT (FAILED)\n");
224 return; 216 return;
225} 217}
226 218
@@ -290,8 +282,8 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int count,
290 282
291 baseblk = ((i_size_read(inode) - 1) >> inode->i_blkbits) + 1 - count; 283 baseblk = ((i_size_read(inode) - 1) >> inode->i_blkbits) + 1 - count;
292 284
293 UFSD(("ENTER, ino %lu, count %u, oldb %u, newb %u\n", 285 UFSD("ENTER, ino %lu, count %u, oldb %u, newb %u\n",
294 inode->i_ino, count, oldb, newb)); 286 inode->i_ino, count, oldb, newb);
295 287
296 BUG_ON(!PageLocked(locked_page)); 288 BUG_ON(!PageLocked(locked_page));
297 289
@@ -326,7 +318,7 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int count,
326 page_cache_release(page); 318 page_cache_release(page);
327 } 319 }
328 } 320 }
329 UFSD(("EXIT\n")); 321 UFSD("EXIT\n");
330} 322}
331 323
332unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment, 324unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
@@ -337,7 +329,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
337 struct ufs_super_block_first * usb1; 329 struct ufs_super_block_first * usb1;
338 unsigned cgno, oldcount, newcount, tmp, request, result; 330 unsigned cgno, oldcount, newcount, tmp, request, result;
339 331
340 UFSD(("ENTER, ino %lu, fragment %u, goal %u, count %u\n", inode->i_ino, fragment, goal, count)) 332 UFSD("ENTER, ino %lu, fragment %u, goal %u, count %u\n", inode->i_ino, fragment, goal, count);
341 333
342 sb = inode->i_sb; 334 sb = inode->i_sb;
343 uspi = UFS_SB(sb)->s_uspi; 335 uspi = UFS_SB(sb)->s_uspi;
@@ -366,14 +358,14 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
366 return (unsigned)-1; 358 return (unsigned)-1;
367 } 359 }
368 if (fragment < UFS_I(inode)->i_lastfrag) { 360 if (fragment < UFS_I(inode)->i_lastfrag) {
369 UFSD(("EXIT (ALREADY ALLOCATED)\n")) 361 UFSD("EXIT (ALREADY ALLOCATED)\n");
370 unlock_super (sb); 362 unlock_super (sb);
371 return 0; 363 return 0;
372 } 364 }
373 } 365 }
374 else { 366 else {
375 if (tmp) { 367 if (tmp) {
376 UFSD(("EXIT (ALREADY ALLOCATED)\n")) 368 UFSD("EXIT (ALREADY ALLOCATED)\n");
377 unlock_super(sb); 369 unlock_super(sb);
378 return 0; 370 return 0;
379 } 371 }
@@ -384,7 +376,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
384 */ 376 */
385 if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(usb1, UFS_MINFREE) <= 0) { 377 if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(usb1, UFS_MINFREE) <= 0) {
386 unlock_super (sb); 378 unlock_super (sb);
387 UFSD(("EXIT (FAILED)\n")) 379 UFSD("EXIT (FAILED)\n");
388 return 0; 380 return 0;
389 } 381 }
390 382
@@ -407,7 +399,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
407 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); 399 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
408 } 400 }
409 unlock_super(sb); 401 unlock_super(sb);
410 UFSD(("EXIT, result %u\n", result)) 402 UFSD("EXIT, result %u\n", result);
411 return result; 403 return result;
412 } 404 }
413 405
@@ -420,7 +412,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
420 inode->i_blocks += count << uspi->s_nspfshift; 412 inode->i_blocks += count << uspi->s_nspfshift;
421 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); 413 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
422 unlock_super(sb); 414 unlock_super(sb);
423 UFSD(("EXIT, result %u\n", result)) 415 UFSD("EXIT, result %u\n", result);
424 return result; 416 return result;
425 } 417 }
426 418
@@ -458,12 +450,12 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
458 if (newcount < request) 450 if (newcount < request)
459 ufs_free_fragments (inode, result + newcount, request - newcount); 451 ufs_free_fragments (inode, result + newcount, request - newcount);
460 ufs_free_fragments (inode, tmp, oldcount); 452 ufs_free_fragments (inode, tmp, oldcount);
461 UFSD(("EXIT, result %u\n", result)) 453 UFSD("EXIT, result %u\n", result);
462 return result; 454 return result;
463 } 455 }
464 456
465 unlock_super(sb); 457 unlock_super(sb);
466 UFSD(("EXIT (FAILED)\n")) 458 UFSD("EXIT (FAILED)\n");
467 return 0; 459 return 0;
468} 460}
469 461
@@ -478,7 +470,7 @@ ufs_add_fragments (struct inode * inode, unsigned fragment,
478 struct ufs_cylinder_group * ucg; 470 struct ufs_cylinder_group * ucg;
479 unsigned cgno, fragno, fragoff, count, fragsize, i; 471 unsigned cgno, fragno, fragoff, count, fragsize, i;
480 472
481 UFSD(("ENTER, fragment %u, oldcount %u, newcount %u\n", fragment, oldcount, newcount)) 473 UFSD("ENTER, fragment %u, oldcount %u, newcount %u\n", fragment, oldcount, newcount);
482 474
483 sb = inode->i_sb; 475 sb = inode->i_sb;
484 uspi = UFS_SB(sb)->s_uspi; 476 uspi = UFS_SB(sb)->s_uspi;
@@ -538,7 +530,7 @@ ufs_add_fragments (struct inode * inode, unsigned fragment,
538 } 530 }
539 sb->s_dirt = 1; 531 sb->s_dirt = 1;
540 532
541 UFSD(("EXIT, fragment %u\n", fragment)) 533 UFSD("EXIT, fragment %u\n", fragment);
542 534
543 return fragment; 535 return fragment;
544} 536}
@@ -561,7 +553,7 @@ static unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
561 struct ufs_cylinder_group * ucg; 553 struct ufs_cylinder_group * ucg;
562 unsigned oldcg, i, j, k, result, allocsize; 554 unsigned oldcg, i, j, k, result, allocsize;
563 555
564 UFSD(("ENTER, ino %lu, cgno %u, goal %u, count %u\n", inode->i_ino, cgno, goal, count)) 556 UFSD("ENTER, ino %lu, cgno %u, goal %u, count %u\n", inode->i_ino, cgno, goal, count);
565 557
566 sb = inode->i_sb; 558 sb = inode->i_sb;
567 uspi = UFS_SB(sb)->s_uspi; 559 uspi = UFS_SB(sb)->s_uspi;
@@ -595,7 +587,7 @@ static unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
595 UFS_TEST_FREE_SPACE_CG 587 UFS_TEST_FREE_SPACE_CG
596 } 588 }
597 589
598 UFSD(("EXIT (FAILED)\n")) 590 UFSD("EXIT (FAILED)\n");
599 return 0; 591 return 0;
600 592
601cg_found: 593cg_found:
@@ -664,7 +656,7 @@ succed:
664 sb->s_dirt = 1; 656 sb->s_dirt = 1;
665 657
666 result += cgno * uspi->s_fpg; 658 result += cgno * uspi->s_fpg;
667 UFSD(("EXIT3, result %u\n", result)) 659 UFSD("EXIT3, result %u\n", result);
668 return result; 660 return result;
669} 661}
670 662
@@ -677,7 +669,7 @@ static unsigned ufs_alloccg_block (struct inode * inode,
677 struct ufs_cylinder_group * ucg; 669 struct ufs_cylinder_group * ucg;
678 unsigned result, cylno, blkno; 670 unsigned result, cylno, blkno;
679 671
680 UFSD(("ENTER, goal %u\n", goal)) 672 UFSD("ENTER, goal %u\n", goal);
681 673
682 sb = inode->i_sb; 674 sb = inode->i_sb;
683 uspi = UFS_SB(sb)->s_uspi; 675 uspi = UFS_SB(sb)->s_uspi;
@@ -721,7 +713,7 @@ gotit:
721 fs16_sub(sb, &ubh_cg_blks(ucpi, cylno, ufs_cbtorpos(result)), 1); 713 fs16_sub(sb, &ubh_cg_blks(ucpi, cylno, ufs_cbtorpos(result)), 1);
722 fs32_sub(sb, &ubh_cg_blktot(ucpi, cylno), 1); 714 fs32_sub(sb, &ubh_cg_blktot(ucpi, cylno), 1);
723 715
724 UFSD(("EXIT, result %u\n", result)) 716 UFSD("EXIT, result %u\n", result);
725 717
726 return result; 718 return result;
727} 719}
@@ -781,7 +773,7 @@ static unsigned ufs_bitmap_search(struct super_block *sb,
781 unsigned start, length, loc, result; 773 unsigned start, length, loc, result;
782 unsigned pos, want, blockmap, mask, end; 774 unsigned pos, want, blockmap, mask, end;
783 775
784 UFSD(("ENTER, cg %u, goal %u, count %u\n", ucpi->c_cgx, goal, count)); 776 UFSD("ENTER, cg %u, goal %u, count %u\n", ucpi->c_cgx, goal, count);
785 777
786 usb1 = ubh_get_usb_first (uspi); 778 usb1 = ubh_get_usb_first (uspi);
787 ucg = ubh_get_ucg(UCPI_UBH(ucpi)); 779 ucg = ubh_get_ucg(UCPI_UBH(ucpi));
@@ -825,7 +817,7 @@ static unsigned ufs_bitmap_search(struct super_block *sb,
825 want = want_arr[count]; 817 want = want_arr[count];
826 for (pos = 0; pos <= uspi->s_fpb - count; pos++) { 818 for (pos = 0; pos <= uspi->s_fpb - count; pos++) {
827 if ((blockmap & mask) == want) { 819 if ((blockmap & mask) == want) {
828 UFSD(("EXIT, result %u\n", result)); 820 UFSD("EXIT, result %u\n", result);
829 return result + pos; 821 return result + pos;
830 } 822 }
831 mask <<= 1; 823 mask <<= 1;
@@ -835,7 +827,7 @@ static unsigned ufs_bitmap_search(struct super_block *sb,
835 827
836 ufs_error(sb, "ufs_bitmap_search", "block not in map on cg %u\n", 828 ufs_error(sb, "ufs_bitmap_search", "block not in map on cg %u\n",
837 ucpi->c_cgx); 829 ucpi->c_cgx);
838 UFSD(("EXIT (FAILED)\n")); 830 UFSD("EXIT (FAILED)\n");
839 return (unsigned)-1; 831 return (unsigned)-1;
840} 832}
841 833
diff --git a/fs/ufs/cylinder.c b/fs/ufs/cylinder.c
index 65fe06810172..09c39e5e6386 100644
--- a/fs/ufs/cylinder.c
+++ b/fs/ufs/cylinder.c
@@ -20,15 +20,6 @@
20#include "swab.h" 20#include "swab.h"
21#include "util.h" 21#include "util.h"
22 22
23#undef UFS_CYLINDER_DEBUG
24
25#ifdef UFS_CYLINDER_DEBUG
26#define UFSD(x) printk("(%s, %d), %s:", __FILE__, __LINE__, __FUNCTION__); printk x;
27#else
28#define UFSD(x)
29#endif
30
31
32/* 23/*
33 * Read cylinder group into cache. The memory space for ufs_cg_private_info 24 * Read cylinder group into cache. The memory space for ufs_cg_private_info
34 * structure is already allocated during ufs_read_super. 25 * structure is already allocated during ufs_read_super.
@@ -42,7 +33,7 @@ static void ufs_read_cylinder (struct super_block * sb,
42 struct ufs_cylinder_group * ucg; 33 struct ufs_cylinder_group * ucg;
43 unsigned i, j; 34 unsigned i, j;
44 35
45 UFSD(("ENTER, cgno %u, bitmap_nr %u\n", cgno, bitmap_nr)) 36 UFSD("ENTER, cgno %u, bitmap_nr %u\n", cgno, bitmap_nr);
46 uspi = sbi->s_uspi; 37 uspi = sbi->s_uspi;
47 ucpi = sbi->s_ucpi[bitmap_nr]; 38 ucpi = sbi->s_ucpi[bitmap_nr];
48 ucg = (struct ufs_cylinder_group *)sbi->s_ucg[cgno]->b_data; 39 ucg = (struct ufs_cylinder_group *)sbi->s_ucg[cgno]->b_data;
@@ -73,7 +64,7 @@ static void ufs_read_cylinder (struct super_block * sb,
73 ucpi->c_clustersumoff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clustersumoff); 64 ucpi->c_clustersumoff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clustersumoff);
74 ucpi->c_clusteroff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clusteroff); 65 ucpi->c_clusteroff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clusteroff);
75 ucpi->c_nclusterblks = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_nclusterblks); 66 ucpi->c_nclusterblks = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_nclusterblks);
76 UFSD(("EXIT\n")) 67 UFSD("EXIT\n");
77 return; 68 return;
78 69
79failed: 70failed:
@@ -95,11 +86,11 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
95 struct ufs_cylinder_group * ucg; 86 struct ufs_cylinder_group * ucg;
96 unsigned i; 87 unsigned i;
97 88
98 UFSD(("ENTER, bitmap_nr %u\n", bitmap_nr)) 89 UFSD("ENTER, bitmap_nr %u\n", bitmap_nr);
99 90
100 uspi = sbi->s_uspi; 91 uspi = sbi->s_uspi;
101 if (sbi->s_cgno[bitmap_nr] == UFS_CGNO_EMPTY) { 92 if (sbi->s_cgno[bitmap_nr] == UFS_CGNO_EMPTY) {
102 UFSD(("EXIT\n")) 93 UFSD("EXIT\n");
103 return; 94 return;
104 } 95 }
105 ucpi = sbi->s_ucpi[bitmap_nr]; 96 ucpi = sbi->s_ucpi[bitmap_nr];
@@ -122,7 +113,7 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
122 } 113 }
123 114
124 sbi->s_cgno[bitmap_nr] = UFS_CGNO_EMPTY; 115 sbi->s_cgno[bitmap_nr] = UFS_CGNO_EMPTY;
125 UFSD(("EXIT\n")) 116 UFSD("EXIT\n");
126} 117}
127 118
128/* 119/*
@@ -139,7 +130,7 @@ struct ufs_cg_private_info * ufs_load_cylinder (
139 struct ufs_cg_private_info * ucpi; 130 struct ufs_cg_private_info * ucpi;
140 unsigned cg, i, j; 131 unsigned cg, i, j;
141 132
142 UFSD(("ENTER, cgno %u\n", cgno)) 133 UFSD("ENTER, cgno %u\n", cgno);
143 134
144 uspi = sbi->s_uspi; 135 uspi = sbi->s_uspi;
145 if (cgno >= uspi->s_ncg) { 136 if (cgno >= uspi->s_ncg) {
@@ -150,7 +141,7 @@ struct ufs_cg_private_info * ufs_load_cylinder (
150 * Cylinder group number cg it in cache and it was last used 141 * Cylinder group number cg it in cache and it was last used
151 */ 142 */
152 if (sbi->s_cgno[0] == cgno) { 143 if (sbi->s_cgno[0] == cgno) {
153 UFSD(("EXIT\n")) 144 UFSD("EXIT\n");
154 return sbi->s_ucpi[0]; 145 return sbi->s_ucpi[0];
155 } 146 }
156 /* 147 /*
@@ -160,16 +151,16 @@ struct ufs_cg_private_info * ufs_load_cylinder (
160 if (sbi->s_cgno[cgno] != UFS_CGNO_EMPTY) { 151 if (sbi->s_cgno[cgno] != UFS_CGNO_EMPTY) {
161 if (sbi->s_cgno[cgno] != cgno) { 152 if (sbi->s_cgno[cgno] != cgno) {
162 ufs_panic (sb, "ufs_load_cylinder", "internal error, wrong number of cg in cache"); 153 ufs_panic (sb, "ufs_load_cylinder", "internal error, wrong number of cg in cache");
163 UFSD(("EXIT (FAILED)\n")) 154 UFSD("EXIT (FAILED)\n");
164 return NULL; 155 return NULL;
165 } 156 }
166 else { 157 else {
167 UFSD(("EXIT\n")) 158 UFSD("EXIT\n");
168 return sbi->s_ucpi[cgno]; 159 return sbi->s_ucpi[cgno];
169 } 160 }
170 } else { 161 } else {
171 ufs_read_cylinder (sb, cgno, cgno); 162 ufs_read_cylinder (sb, cgno, cgno);
172 UFSD(("EXIT\n")) 163 UFSD("EXIT\n");
173 return sbi->s_ucpi[cgno]; 164 return sbi->s_ucpi[cgno];
174 } 165 }
175 } 166 }
@@ -204,6 +195,6 @@ struct ufs_cg_private_info * ufs_load_cylinder (
204 sbi->s_ucpi[0] = ucpi; 195 sbi->s_ucpi[0] = ucpi;
205 ufs_read_cylinder (sb, cgno, 0); 196 ufs_read_cylinder (sb, cgno, 0);
206 } 197 }
207 UFSD(("EXIT\n")) 198 UFSD("EXIT\n");
208 return sbi->s_ucpi[0]; 199 return sbi->s_ucpi[0];
209} 200}
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 9473df5bff51..732c3fd2b6f2 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -25,14 +25,6 @@
25#include "swab.h" 25#include "swab.h"
26#include "util.h" 26#include "util.h"
27 27
28#undef UFS_DIR_DEBUG
29
30#ifdef UFS_DIR_DEBUG
31#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
32#else
33#define UFSD(x)
34#endif
35
36/* 28/*
37 * NOTE! unlike strncmp, ufs_match returns 1 for success, 0 for failure. 29 * NOTE! unlike strncmp, ufs_match returns 1 for success, 0 for failure.
38 * 30 *
@@ -262,7 +254,7 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, struct dentry *dentry,
262 struct page *page = NULL; 254 struct page *page = NULL;
263 struct ufs_dir_entry *de; 255 struct ufs_dir_entry *de;
264 256
265 UFSD(("ENTER, dir_ino %lu, name %s, namlen %u\n", dir->i_ino, name, namelen)); 257 UFSD("ENTER, dir_ino %lu, name %s, namlen %u\n", dir->i_ino, name, namelen);
266 258
267 if (npages == 0 || namelen > UFS_MAXNAMLEN) 259 if (npages == 0 || namelen > UFS_MAXNAMLEN)
268 goto out; 260 goto out;
@@ -326,7 +318,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode)
326 unsigned from, to; 318 unsigned from, to;
327 int err; 319 int err;
328 320
329 UFSD(("ENTER, name %s, namelen %u\n", name, namelen)); 321 UFSD("ENTER, name %s, namelen %u\n", name, namelen);
330 322
331 /* 323 /*
332 * We take care of directory expansion in the same loop. 324 * We take care of directory expansion in the same loop.
@@ -442,7 +434,7 @@ ufs_readdir(struct file *filp, void *dirent, filldir_t filldir)
442 int need_revalidate = filp->f_version != inode->i_version; 434 int need_revalidate = filp->f_version != inode->i_version;
443 unsigned flags = UFS_SB(sb)->s_flags; 435 unsigned flags = UFS_SB(sb)->s_flags;
444 436
445 UFSD(("BEGIN")); 437 UFSD("BEGIN\n");
446 438
447 if (pos > inode->i_size - UFS_DIR_REC_LEN(1)) 439 if (pos > inode->i_size - UFS_DIR_REC_LEN(1))
448 return 0; 440 return 0;
@@ -484,9 +476,9 @@ ufs_readdir(struct file *filp, void *dirent, filldir_t filldir)
484 476
485 offset = (char *)de - kaddr; 477 offset = (char *)de - kaddr;
486 478
487 UFSD(("filldir(%s,%u)\n", de->d_name, 479 UFSD("filldir(%s,%u)\n", de->d_name,
488 fs32_to_cpu(sb, de->d_ino))); 480 fs32_to_cpu(sb, de->d_ino));
489 UFSD(("namlen %u\n", ufs_get_de_namlen(sb, de))); 481 UFSD("namlen %u\n", ufs_get_de_namlen(sb, de));
490 482
491 if ((flags & UFS_DE_MASK) == UFS_DE_44BSD) 483 if ((flags & UFS_DE_MASK) == UFS_DE_44BSD)
492 d_type = de->d_u.d_44.d_type; 484 d_type = de->d_u.d_44.d_type;
@@ -524,12 +516,12 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
524 struct ufs_dir_entry *de = (struct ufs_dir_entry *) (kaddr + from); 516 struct ufs_dir_entry *de = (struct ufs_dir_entry *) (kaddr + from);
525 int err; 517 int err;
526 518
527 UFSD(("ENTER\n")); 519 UFSD("ENTER\n");
528 520
529 UFSD(("ino %u, reclen %u, namlen %u, name %s\n", 521 UFSD("ino %u, reclen %u, namlen %u, name %s\n",
530 fs32_to_cpu(sb, de->d_ino), 522 fs32_to_cpu(sb, de->d_ino),
531 fs16_to_cpu(sb, de->d_reclen), 523 fs16_to_cpu(sb, de->d_reclen),
532 ufs_get_de_namlen(sb, de), de->d_name)); 524 ufs_get_de_namlen(sb, de), de->d_name);
533 525
534 while ((char*)de < (char*)dir) { 526 while ((char*)de < (char*)dir) {
535 if (de->d_reclen == 0) { 527 if (de->d_reclen == 0) {
@@ -554,7 +546,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
554 mark_inode_dirty(inode); 546 mark_inode_dirty(inode);
555out: 547out:
556 ufs_put_page(page); 548 ufs_put_page(page);
557 UFSD(("EXIT\n")); 549 UFSD("EXIT\n");
558 return err; 550 return err;
559} 551}
560 552
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index 2da0ffda82cc..ad017fa2dd21 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -34,14 +34,6 @@
34#include "swab.h" 34#include "swab.h"
35#include "util.h" 35#include "util.h"
36 36
37#undef UFS_IALLOC_DEBUG
38
39#ifdef UFS_IALLOC_DEBUG
40#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
41#else
42#define UFSD(x)
43#endif
44
45/* 37/*
46 * NOTE! When we get the inode, we're the only people 38 * NOTE! When we get the inode, we're the only people
47 * that have access to it, and as such there are no 39 * that have access to it, and as such there are no
@@ -68,7 +60,7 @@ void ufs_free_inode (struct inode * inode)
68 int is_directory; 60 int is_directory;
69 unsigned ino, cg, bit; 61 unsigned ino, cg, bit;
70 62
71 UFSD(("ENTER, ino %lu\n", inode->i_ino)) 63 UFSD("ENTER, ino %lu\n", inode->i_ino);
72 64
73 sb = inode->i_sb; 65 sb = inode->i_sb;
74 uspi = UFS_SB(sb)->s_uspi; 66 uspi = UFS_SB(sb)->s_uspi;
@@ -130,7 +122,7 @@ void ufs_free_inode (struct inode * inode)
130 122
131 sb->s_dirt = 1; 123 sb->s_dirt = 1;
132 unlock_super (sb); 124 unlock_super (sb);
133 UFSD(("EXIT\n")) 125 UFSD("EXIT\n");
134} 126}
135 127
136/* 128/*
@@ -155,7 +147,7 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
155 unsigned cg, bit, i, j, start; 147 unsigned cg, bit, i, j, start;
156 struct ufs_inode_info *ufsi; 148 struct ufs_inode_info *ufsi;
157 149
158 UFSD(("ENTER\n")) 150 UFSD("ENTER\n");
159 151
160 /* Cannot create files in a deleted directory */ 152 /* Cannot create files in a deleted directory */
161 if (!dir || !dir->i_nlink) 153 if (!dir || !dir->i_nlink)
@@ -227,7 +219,7 @@ cg_found:
227 goto failed; 219 goto failed;
228 } 220 }
229 } 221 }
230 UFSD(("start = %u, bit = %u, ipg = %u\n", start, bit, uspi->s_ipg)) 222 UFSD("start = %u, bit = %u, ipg = %u\n", start, bit, uspi->s_ipg);
231 if (ubh_isclr (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit)) 223 if (ubh_isclr (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit))
232 ubh_setbit (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit); 224 ubh_setbit (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit);
233 else { 225 else {
@@ -287,14 +279,14 @@ cg_found:
287 return ERR_PTR(-EDQUOT); 279 return ERR_PTR(-EDQUOT);
288 } 280 }
289 281
290 UFSD(("allocating inode %lu\n", inode->i_ino)) 282 UFSD("allocating inode %lu\n", inode->i_ino);
291 UFSD(("EXIT\n")) 283 UFSD("EXIT\n");
292 return inode; 284 return inode;
293 285
294failed: 286failed:
295 unlock_super (sb); 287 unlock_super (sb);
296 make_bad_inode(inode); 288 make_bad_inode(inode);
297 iput (inode); 289 iput (inode);
298 UFSD(("EXIT (FAILED)\n")) 290 UFSD("EXIT (FAILED)\n");
299 return ERR_PTR(-ENOSPC); 291 return ERR_PTR(-ENOSPC);
300} 292}
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
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index 364bb92b0917..abd5f23a426d 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -34,17 +34,6 @@
34#include "swab.h" /* will go away - see comment in mknod() */ 34#include "swab.h" /* will go away - see comment in mknod() */
35#include "util.h" 35#include "util.h"
36 36
37/*
38#undef UFS_NAMEI_DEBUG
39*/
40#define UFS_NAMEI_DEBUG
41
42#ifdef UFS_NAMEI_DEBUG
43#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
44#else
45#define UFSD(x)
46#endif
47
48static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) 37static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode)
49{ 38{
50 int err = ufs_add_link(dentry, inode); 39 int err = ufs_add_link(dentry, inode);
@@ -90,8 +79,13 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, stru
90static int ufs_create (struct inode * dir, struct dentry * dentry, int mode, 79static int ufs_create (struct inode * dir, struct dentry * dentry, int mode,
91 struct nameidata *nd) 80 struct nameidata *nd)
92{ 81{
93 struct inode * inode = ufs_new_inode(dir, mode); 82 struct inode *inode;
94 int err = PTR_ERR(inode); 83 int err;
84
85 UFSD("BEGIN\n");
86 inode = ufs_new_inode(dir, mode);
87 err = PTR_ERR(inode);
88
95 if (!IS_ERR(inode)) { 89 if (!IS_ERR(inode)) {
96 inode->i_op = &ufs_file_inode_operations; 90 inode->i_op = &ufs_file_inode_operations;
97 inode->i_fop = &ufs_file_operations; 91 inode->i_fop = &ufs_file_operations;
@@ -101,6 +95,7 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, int mode,
101 err = ufs_add_nondir(dentry, inode); 95 err = ufs_add_nondir(dentry, inode);
102 unlock_kernel(); 96 unlock_kernel();
103 } 97 }
98 UFSD("END: err=%d\n", err);
104 return err; 99 return err;
105} 100}
106 101
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index c00d1e741529..42425999d2d3 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -90,18 +90,7 @@
90#include "swab.h" 90#include "swab.h"
91#include "util.h" 91#include "util.h"
92 92
93#undef UFS_SUPER_DEBUG 93#ifdef CONFIG_UFS_DEBUG
94#undef UFS_SUPER_DEBUG_MORE
95
96
97#undef UFS_SUPER_DEBUG_MORE
98#ifdef UFS_SUPER_DEBUG
99#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
100#else
101#define UFSD(x)
102#endif
103
104#ifdef UFS_SUPER_DEBUG_MORE
105/* 94/*
106 * Print contents of ufs_super_block, useful for debugging 95 * Print contents of ufs_super_block, useful for debugging
107 */ 96 */
@@ -157,18 +146,23 @@ void ufs2_print_super_stuff(
157 printk("ufs_print_super_stuff\n"); 146 printk("ufs_print_super_stuff\n");
158 printk("size of usb: %u\n", sizeof(struct ufs_super_block)); 147 printk("size of usb: %u\n", sizeof(struct ufs_super_block));
159 printk(" magic: 0x%x\n", fs32_to_cpu(sb, usb->fs_magic)); 148 printk(" magic: 0x%x\n", fs32_to_cpu(sb, usb->fs_magic));
160 printk(" fs_size: %u\n",fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_size)); 149 printk(" fs_size: %llu\n",
161 printk(" fs_dsize: %u\n",fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_dsize)); 150 (unsigned long long)fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_size));
162 printk(" bsize: %u\n", fs32_to_cpu(usb, usb->fs_bsize)); 151 printk(" fs_dsize: %llu\n",
163 printk(" fsize: %u\n", fs32_to_cpu(usb, usb->fs_fsize)); 152 (unsigned long long)fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_dsize));
153 printk(" bsize: %u\n", fs32_to_cpu(sb, usb->fs_bsize));
154 printk(" fsize: %u\n", fs32_to_cpu(sb, usb->fs_fsize));
164 printk(" fs_volname: %s\n", usb->fs_u11.fs_u2.fs_volname); 155 printk(" fs_volname: %s\n", usb->fs_u11.fs_u2.fs_volname);
165 printk(" fs_fsmnt: %s\n", usb->fs_u11.fs_u2.fs_fsmnt); 156 printk(" fs_fsmnt: %s\n", usb->fs_u11.fs_u2.fs_fsmnt);
166 printk(" fs_sblockloc: %u\n",fs64_to_cpu(sb, 157 printk(" fs_sblockloc: %llu\n",
167 usb->fs_u11.fs_u2.fs_sblockloc)); 158 (unsigned long long)fs64_to_cpu(sb,
168 printk(" cs_ndir(No of dirs): %u\n",fs64_to_cpu(sb, 159 usb->fs_u11.fs_u2.fs_sblockloc));
169 usb->fs_u11.fs_u2.fs_cstotal.cs_ndir)); 160 printk(" cs_ndir(No of dirs): %llu\n",
170 printk(" cs_nbfree(No of free blocks): %u\n",fs64_to_cpu(sb, 161 (unsigned long long)fs64_to_cpu(sb,
171 usb->fs_u11.fs_u2.fs_cstotal.cs_nbfree)); 162 usb->fs_u11.fs_u2.fs_cstotal.cs_ndir));
163 printk(" cs_nbfree(No of free blocks): %llu\n",
164 (unsigned long long)fs64_to_cpu(sb,
165 usb->fs_u11.fs_u2.fs_cstotal.cs_nbfree));
172 printk("\n"); 166 printk("\n");
173} 167}
174 168
@@ -207,7 +201,7 @@ void ufs_print_cylinder_stuff(struct super_block *sb, struct ufs_cylinder_group
207 printk(" nclusterblks %u\n", fs32_to_cpu(sb, cg->cg_u.cg_44.cg_nclusterblks)); 201 printk(" nclusterblks %u\n", fs32_to_cpu(sb, cg->cg_u.cg_44.cg_nclusterblks));
208 printk("\n"); 202 printk("\n");
209} 203}
210#endif /* UFS_SUPER_DEBUG_MORE */ 204#endif /* CONFIG_UFS_DEBUG */
211 205
212static struct super_operations ufs_super_ops; 206static struct super_operations ufs_super_ops;
213 207
@@ -309,7 +303,7 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
309{ 303{
310 char * p; 304 char * p;
311 305
312 UFSD(("ENTER\n")) 306 UFSD("ENTER\n");
313 307
314 if (!options) 308 if (!options)
315 return 1; 309 return 1;
@@ -398,7 +392,7 @@ static int ufs_read_cylinder_structures (struct super_block *sb)
398 unsigned size, blks, i; 392 unsigned size, blks, i;
399 unsigned flags = 0; 393 unsigned flags = 0;
400 394
401 UFSD(("ENTER\n")) 395 UFSD("ENTER\n");
402 396
403 uspi = sbi->s_uspi; 397 uspi = sbi->s_uspi;
404 398
@@ -451,12 +445,12 @@ static int ufs_read_cylinder_structures (struct super_block *sb)
451 sbi->s_cgno[i] = UFS_CGNO_EMPTY; 445 sbi->s_cgno[i] = UFS_CGNO_EMPTY;
452 } 446 }
453 for (i = 0; i < uspi->s_ncg; i++) { 447 for (i = 0; i < uspi->s_ncg; i++) {
454 UFSD(("read cg %u\n", i)) 448 UFSD("read cg %u\n", i);
455 if (!(sbi->s_ucg[i] = sb_bread(sb, ufs_cgcmin(i)))) 449 if (!(sbi->s_ucg[i] = sb_bread(sb, ufs_cgcmin(i))))
456 goto failed; 450 goto failed;
457 if (!ufs_cg_chkmagic (sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data)) 451 if (!ufs_cg_chkmagic (sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data))
458 goto failed; 452 goto failed;
459#ifdef UFS_SUPER_DEBUG_MORE 453#ifdef CONFIG_UFS_DEBUG
460 ufs_print_cylinder_stuff(sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data); 454 ufs_print_cylinder_stuff(sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data);
461#endif 455#endif
462 } 456 }
@@ -466,7 +460,7 @@ static int ufs_read_cylinder_structures (struct super_block *sb)
466 sbi->s_cgno[i] = UFS_CGNO_EMPTY; 460 sbi->s_cgno[i] = UFS_CGNO_EMPTY;
467 } 461 }
468 sbi->s_cg_loaded = 0; 462 sbi->s_cg_loaded = 0;
469 UFSD(("EXIT\n")) 463 UFSD("EXIT\n");
470 return 1; 464 return 1;
471 465
472failed: 466failed:
@@ -479,7 +473,7 @@ failed:
479 for (i = 0; i < UFS_MAX_GROUP_LOADED; i++) 473 for (i = 0; i < UFS_MAX_GROUP_LOADED; i++)
480 kfree (sbi->s_ucpi[i]); 474 kfree (sbi->s_ucpi[i]);
481 } 475 }
482 UFSD(("EXIT (FAILED)\n")) 476 UFSD("EXIT (FAILED)\n");
483 return 0; 477 return 0;
484} 478}
485 479
@@ -495,7 +489,7 @@ static void ufs_put_cylinder_structures (struct super_block *sb)
495 unsigned char * base, * space; 489 unsigned char * base, * space;
496 unsigned blks, size, i; 490 unsigned blks, size, i;
497 491
498 UFSD(("ENTER\n")) 492 UFSD("ENTER\n");
499 493
500 uspi = sbi->s_uspi; 494 uspi = sbi->s_uspi;
501 495
@@ -523,7 +517,7 @@ static void ufs_put_cylinder_structures (struct super_block *sb)
523 brelse (sbi->s_ucg[i]); 517 brelse (sbi->s_ucg[i]);
524 kfree (sbi->s_ucg); 518 kfree (sbi->s_ucg);
525 kfree (base); 519 kfree (base);
526 UFSD(("EXIT\n")) 520 UFSD("EXIT\n");
527} 521}
528 522
529static int ufs_fill_super(struct super_block *sb, void *data, int silent) 523static int ufs_fill_super(struct super_block *sb, void *data, int silent)
@@ -544,7 +538,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
544 ubh = NULL; 538 ubh = NULL;
545 flags = 0; 539 flags = 0;
546 540
547 UFSD(("ENTER\n")) 541 UFSD("ENTER\n");
548 542
549 sbi = kmalloc(sizeof(struct ufs_sb_info), GFP_KERNEL); 543 sbi = kmalloc(sizeof(struct ufs_sb_info), GFP_KERNEL);
550 if (!sbi) 544 if (!sbi)
@@ -552,7 +546,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
552 sb->s_fs_info = sbi; 546 sb->s_fs_info = sbi;
553 memset(sbi, 0, sizeof(struct ufs_sb_info)); 547 memset(sbi, 0, sizeof(struct ufs_sb_info));
554 548
555 UFSD(("flag %u\n", (int)(sb->s_flags & MS_RDONLY))) 549 UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY));
556 550
557#ifndef CONFIG_UFS_FS_WRITE 551#ifndef CONFIG_UFS_FS_WRITE
558 if (!(sb->s_flags & MS_RDONLY)) { 552 if (!(sb->s_flags & MS_RDONLY)) {
@@ -593,7 +587,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
593 the rules */ 587 the rules */
594 switch (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) { 588 switch (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) {
595 case UFS_MOUNT_UFSTYPE_44BSD: 589 case UFS_MOUNT_UFSTYPE_44BSD:
596 UFSD(("ufstype=44bsd\n")) 590 UFSD("ufstype=44bsd\n");
597 uspi->s_fsize = block_size = 512; 591 uspi->s_fsize = block_size = 512;
598 uspi->s_fmask = ~(512 - 1); 592 uspi->s_fmask = ~(512 - 1);
599 uspi->s_fshift = 9; 593 uspi->s_fshift = 9;
@@ -602,7 +596,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
602 flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD; 596 flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD;
603 break; 597 break;
604 case UFS_MOUNT_UFSTYPE_UFS2: 598 case UFS_MOUNT_UFSTYPE_UFS2:
605 UFSD(("ufstype=ufs2\n")); 599 UFSD("ufstype=ufs2\n");
606 super_block_offset=SBLOCK_UFS2; 600 super_block_offset=SBLOCK_UFS2;
607 uspi->s_fsize = block_size = 512; 601 uspi->s_fsize = block_size = 512;
608 uspi->s_fmask = ~(512 - 1); 602 uspi->s_fmask = ~(512 - 1);
@@ -617,7 +611,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
617 break; 611 break;
618 612
619 case UFS_MOUNT_UFSTYPE_SUN: 613 case UFS_MOUNT_UFSTYPE_SUN:
620 UFSD(("ufstype=sun\n")) 614 UFSD("ufstype=sun\n");
621 uspi->s_fsize = block_size = 1024; 615 uspi->s_fsize = block_size = 1024;
622 uspi->s_fmask = ~(1024 - 1); 616 uspi->s_fmask = ~(1024 - 1);
623 uspi->s_fshift = 10; 617 uspi->s_fshift = 10;
@@ -628,7 +622,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
628 break; 622 break;
629 623
630 case UFS_MOUNT_UFSTYPE_SUNx86: 624 case UFS_MOUNT_UFSTYPE_SUNx86:
631 UFSD(("ufstype=sunx86\n")) 625 UFSD("ufstype=sunx86\n");
632 uspi->s_fsize = block_size = 1024; 626 uspi->s_fsize = block_size = 1024;
633 uspi->s_fmask = ~(1024 - 1); 627 uspi->s_fmask = ~(1024 - 1);
634 uspi->s_fshift = 10; 628 uspi->s_fshift = 10;
@@ -639,7 +633,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
639 break; 633 break;
640 634
641 case UFS_MOUNT_UFSTYPE_OLD: 635 case UFS_MOUNT_UFSTYPE_OLD:
642 UFSD(("ufstype=old\n")) 636 UFSD("ufstype=old\n");
643 uspi->s_fsize = block_size = 1024; 637 uspi->s_fsize = block_size = 1024;
644 uspi->s_fmask = ~(1024 - 1); 638 uspi->s_fmask = ~(1024 - 1);
645 uspi->s_fshift = 10; 639 uspi->s_fshift = 10;
@@ -654,7 +648,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
654 break; 648 break;
655 649
656 case UFS_MOUNT_UFSTYPE_NEXTSTEP: 650 case UFS_MOUNT_UFSTYPE_NEXTSTEP:
657 UFSD(("ufstype=nextstep\n")) 651 UFSD("ufstype=nextstep\n");
658 uspi->s_fsize = block_size = 1024; 652 uspi->s_fsize = block_size = 1024;
659 uspi->s_fmask = ~(1024 - 1); 653 uspi->s_fmask = ~(1024 - 1);
660 uspi->s_fshift = 10; 654 uspi->s_fshift = 10;
@@ -669,7 +663,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
669 break; 663 break;
670 664
671 case UFS_MOUNT_UFSTYPE_NEXTSTEP_CD: 665 case UFS_MOUNT_UFSTYPE_NEXTSTEP_CD:
672 UFSD(("ufstype=nextstep-cd\n")) 666 UFSD("ufstype=nextstep-cd\n");
673 uspi->s_fsize = block_size = 2048; 667 uspi->s_fsize = block_size = 2048;
674 uspi->s_fmask = ~(2048 - 1); 668 uspi->s_fmask = ~(2048 - 1);
675 uspi->s_fshift = 11; 669 uspi->s_fshift = 11;
@@ -684,7 +678,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
684 break; 678 break;
685 679
686 case UFS_MOUNT_UFSTYPE_OPENSTEP: 680 case UFS_MOUNT_UFSTYPE_OPENSTEP:
687 UFSD(("ufstype=openstep\n")) 681 UFSD("ufstype=openstep\n");
688 uspi->s_fsize = block_size = 1024; 682 uspi->s_fsize = block_size = 1024;
689 uspi->s_fmask = ~(1024 - 1); 683 uspi->s_fmask = ~(1024 - 1);
690 uspi->s_fshift = 10; 684 uspi->s_fshift = 10;
@@ -699,7 +693,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
699 break; 693 break;
700 694
701 case UFS_MOUNT_UFSTYPE_HP: 695 case UFS_MOUNT_UFSTYPE_HP:
702 UFSD(("ufstype=hp\n")) 696 UFSD("ufstype=hp\n");
703 uspi->s_fsize = block_size = 1024; 697 uspi->s_fsize = block_size = 1024;
704 uspi->s_fmask = ~(1024 - 1); 698 uspi->s_fmask = ~(1024 - 1);
705 uspi->s_fshift = 10; 699 uspi->s_fshift = 10;
@@ -820,11 +814,11 @@ magic_found:
820 ubh = NULL; 814 ubh = NULL;
821 block_size = uspi->s_fsize; 815 block_size = uspi->s_fsize;
822 super_block_size = uspi->s_sbsize; 816 super_block_size = uspi->s_sbsize;
823 UFSD(("another value of block_size or super_block_size %u, %u\n", block_size, super_block_size)) 817 UFSD("another value of block_size or super_block_size %u, %u\n", block_size, super_block_size);
824 goto again; 818 goto again;
825 } 819 }
826 820
827#ifdef UFS_SUPER_DEBUG_MORE 821#ifdef CONFIG_UFS_DEBUG
828 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) 822 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2)
829 ufs2_print_super_stuff(sb,usb); 823 ufs2_print_super_stuff(sb,usb);
830 else 824 else
@@ -842,13 +836,13 @@ magic_found:
842 (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) { 836 (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) {
843 switch(usb1->fs_clean) { 837 switch(usb1->fs_clean) {
844 case UFS_FSCLEAN: 838 case UFS_FSCLEAN:
845 UFSD(("fs is clean\n")) 839 UFSD("fs is clean\n");
846 break; 840 break;
847 case UFS_FSSTABLE: 841 case UFS_FSSTABLE:
848 UFSD(("fs is stable\n")) 842 UFSD("fs is stable\n");
849 break; 843 break;
850 case UFS_FSOSF1: 844 case UFS_FSOSF1:
851 UFSD(("fs is DEC OSF/1\n")) 845 UFSD("fs is DEC OSF/1\n");
852 break; 846 break;
853 case UFS_FSACTIVE: 847 case UFS_FSACTIVE:
854 printk("ufs_read_super: fs is active\n"); 848 printk("ufs_read_super: fs is active\n");
@@ -901,8 +895,8 @@ magic_found:
901 uspi->s_fmask = fs32_to_cpu(sb, usb1->fs_fmask); 895 uspi->s_fmask = fs32_to_cpu(sb, usb1->fs_fmask);
902 uspi->s_bshift = fs32_to_cpu(sb, usb1->fs_bshift); 896 uspi->s_bshift = fs32_to_cpu(sb, usb1->fs_bshift);
903 uspi->s_fshift = fs32_to_cpu(sb, usb1->fs_fshift); 897 uspi->s_fshift = fs32_to_cpu(sb, usb1->fs_fshift);
904 UFSD(("uspi->s_bshift = %d,uspi->s_fshift = %d", uspi->s_bshift, 898 UFSD("uspi->s_bshift = %d,uspi->s_fshift = %d", uspi->s_bshift,
905 uspi->s_fshift)); 899 uspi->s_fshift);
906 uspi->s_fpbshift = fs32_to_cpu(sb, usb1->fs_fragshift); 900 uspi->s_fpbshift = fs32_to_cpu(sb, usb1->fs_fragshift);
907 uspi->s_fsbtodb = fs32_to_cpu(sb, usb1->fs_fsbtodb); 901 uspi->s_fsbtodb = fs32_to_cpu(sb, usb1->fs_fsbtodb);
908 /* s_sbsize already set */ 902 /* s_sbsize already set */
@@ -935,12 +929,11 @@ magic_found:
935 * Compute another frequently used values 929 * Compute another frequently used values
936 */ 930 */
937 uspi->s_fpbmask = uspi->s_fpb - 1; 931 uspi->s_fpbmask = uspi->s_fpb - 1;
938 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) { 932 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2)
939 uspi->s_apbshift = uspi->s_bshift - 3; 933 uspi->s_apbshift = uspi->s_bshift - 3;
940 } 934 else
941 else {
942 uspi->s_apbshift = uspi->s_bshift - 2; 935 uspi->s_apbshift = uspi->s_bshift - 2;
943 } 936
944 uspi->s_2apbshift = uspi->s_apbshift * 2; 937 uspi->s_2apbshift = uspi->s_apbshift * 2;
945 uspi->s_3apbshift = uspi->s_apbshift * 3; 938 uspi->s_3apbshift = uspi->s_apbshift * 3;
946 uspi->s_apb = 1 << uspi->s_apbshift; 939 uspi->s_apb = 1 << uspi->s_apbshift;
@@ -975,7 +968,7 @@ magic_found:
975 if (!ufs_read_cylinder_structures(sb)) 968 if (!ufs_read_cylinder_structures(sb))
976 goto failed; 969 goto failed;
977 970
978 UFSD(("EXIT\n")) 971 UFSD("EXIT\n");
979 return 0; 972 return 0;
980 973
981dalloc_failed: 974dalloc_failed:
@@ -986,11 +979,11 @@ failed:
986 kfree (uspi); 979 kfree (uspi);
987 kfree(sbi); 980 kfree(sbi);
988 sb->s_fs_info = NULL; 981 sb->s_fs_info = NULL;
989 UFSD(("EXIT (FAILED)\n")) 982 UFSD("EXIT (FAILED)\n");
990 return -EINVAL; 983 return -EINVAL;
991 984
992failed_nomem: 985failed_nomem:
993 UFSD(("EXIT (NOMEM)\n")) 986 UFSD("EXIT (NOMEM)\n");
994 return -ENOMEM; 987 return -ENOMEM;
995} 988}
996 989
@@ -1002,7 +995,7 @@ static void ufs_write_super (struct super_block *sb) {
1002 995
1003 lock_kernel(); 996 lock_kernel();
1004 997
1005 UFSD(("ENTER\n")) 998 UFSD("ENTER\n");
1006 flags = UFS_SB(sb)->s_flags; 999 flags = UFS_SB(sb)->s_flags;
1007 uspi = UFS_SB(sb)->s_uspi; 1000 uspi = UFS_SB(sb)->s_uspi;
1008 usb1 = ubh_get_usb_first(uspi); 1001 usb1 = ubh_get_usb_first(uspi);
@@ -1017,15 +1010,15 @@ static void ufs_write_super (struct super_block *sb) {
1017 ubh_mark_buffer_dirty (USPI_UBH(uspi)); 1010 ubh_mark_buffer_dirty (USPI_UBH(uspi));
1018 } 1011 }
1019 sb->s_dirt = 0; 1012 sb->s_dirt = 0;
1020 UFSD(("EXIT\n")) 1013 UFSD("EXIT\n");
1021 unlock_kernel(); 1014 unlock_kernel();
1022} 1015}
1023 1016
1024static void ufs_put_super (struct super_block *sb) 1017static void ufs_put_super(struct super_block *sb)
1025{ 1018{
1026 struct ufs_sb_info * sbi = UFS_SB(sb); 1019 struct ufs_sb_info * sbi = UFS_SB(sb);
1027 1020
1028 UFSD(("ENTER\n")) 1021 UFSD("ENTER\n");
1029 1022
1030 if (!(sb->s_flags & MS_RDONLY)) 1023 if (!(sb->s_flags & MS_RDONLY))
1031 ufs_put_cylinder_structures (sb); 1024 ufs_put_cylinder_structures (sb);
@@ -1034,6 +1027,7 @@ static void ufs_put_super (struct super_block *sb)
1034 kfree (sbi->s_uspi); 1027 kfree (sbi->s_uspi);
1035 kfree (sbi); 1028 kfree (sbi);
1036 sb->s_fs_info = NULL; 1029 sb->s_fs_info = NULL;
1030UFSD("EXIT\n");
1037 return; 1031 return;
1038} 1032}
1039 1033
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index 29c66e1e24df..716183d834e7 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -49,14 +49,6 @@
49#include "swab.h" 49#include "swab.h"
50#include "util.h" 50#include "util.h"
51 51
52#undef UFS_TRUNCATE_DEBUG
53
54#ifdef UFS_TRUNCATE_DEBUG
55#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
56#else
57#define UFSD(x)
58#endif
59
60/* 52/*
61 * Secure deletion currently doesn't work. It interacts very badly 53 * Secure deletion currently doesn't work. It interacts very badly
62 * with buffers shared with memory mappings, and for that reason 54 * with buffers shared with memory mappings, and for that reason
@@ -82,7 +74,7 @@ static int ufs_trunc_direct (struct inode * inode)
82 unsigned i, tmp; 74 unsigned i, tmp;
83 int retry; 75 int retry;
84 76
85 UFSD(("ENTER\n")) 77 UFSD("ENTER\n");
86 78
87 sb = inode->i_sb; 79 sb = inode->i_sb;
88 uspi = UFS_SB(sb)->s_uspi; 80 uspi = UFS_SB(sb)->s_uspi;
@@ -105,7 +97,7 @@ static int ufs_trunc_direct (struct inode * inode)
105 block2 = ufs_fragstoblks (frag3); 97 block2 = ufs_fragstoblks (frag3);
106 } 98 }
107 99
108 UFSD(("frag1 %u, frag2 %u, block1 %u, block2 %u, frag3 %u, frag4 %u\n", frag1, frag2, block1, block2, frag3, frag4)) 100 UFSD("frag1 %u, frag2 %u, block1 %u, block2 %u, frag3 %u, frag4 %u\n", frag1, frag2, block1, block2, frag3, frag4);
109 101
110 if (frag1 >= frag2) 102 if (frag1 >= frag2)
111 goto next1; 103 goto next1;
@@ -171,7 +163,7 @@ next1:
171 ufs_free_fragments (inode, tmp, frag4); 163 ufs_free_fragments (inode, tmp, frag4);
172 next3: 164 next3:
173 165
174 UFSD(("EXIT\n")) 166 UFSD("EXIT\n");
175 return retry; 167 return retry;
176} 168}
177 169
@@ -186,7 +178,7 @@ static int ufs_trunc_indirect (struct inode * inode, unsigned offset, __fs32 *p)
186 unsigned frag_to_free, free_count; 178 unsigned frag_to_free, free_count;
187 int retry; 179 int retry;
188 180
189 UFSD(("ENTER\n")) 181 UFSD("ENTER\n");
190 182
191 sb = inode->i_sb; 183 sb = inode->i_sb;
192 uspi = UFS_SB(sb)->s_uspi; 184 uspi = UFS_SB(sb)->s_uspi;
@@ -252,7 +244,7 @@ static int ufs_trunc_indirect (struct inode * inode, unsigned offset, __fs32 *p)
252 } 244 }
253 ubh_brelse (ind_ubh); 245 ubh_brelse (ind_ubh);
254 246
255 UFSD(("EXIT\n")) 247 UFSD("EXIT\n");
256 248
257 return retry; 249 return retry;
258} 250}
@@ -266,7 +258,7 @@ static int ufs_trunc_dindirect (struct inode *inode, unsigned offset, __fs32 *p)
266 __fs32 * dind; 258 __fs32 * dind;
267 int retry = 0; 259 int retry = 0;
268 260
269 UFSD(("ENTER\n")) 261 UFSD("ENTER\n");
270 262
271 sb = inode->i_sb; 263 sb = inode->i_sb;
272 uspi = UFS_SB(sb)->s_uspi; 264 uspi = UFS_SB(sb)->s_uspi;
@@ -315,7 +307,7 @@ static int ufs_trunc_dindirect (struct inode *inode, unsigned offset, __fs32 *p)
315 } 307 }
316 ubh_brelse (dind_bh); 308 ubh_brelse (dind_bh);
317 309
318 UFSD(("EXIT\n")) 310 UFSD("EXIT\n");
319 311
320 return retry; 312 return retry;
321} 313}
@@ -330,7 +322,7 @@ static int ufs_trunc_tindirect (struct inode * inode)
330 __fs32 * tind, * p; 322 __fs32 * tind, * p;
331 int retry; 323 int retry;
332 324
333 UFSD(("ENTER\n")) 325 UFSD("ENTER\n");
334 326
335 sb = inode->i_sb; 327 sb = inode->i_sb;
336 uspi = UFS_SB(sb)->s_uspi; 328 uspi = UFS_SB(sb)->s_uspi;
@@ -375,7 +367,7 @@ static int ufs_trunc_tindirect (struct inode * inode)
375 } 367 }
376 ubh_brelse (tind_bh); 368 ubh_brelse (tind_bh);
377 369
378 UFSD(("EXIT\n")) 370 UFSD("EXIT\n");
379 return retry; 371 return retry;
380} 372}
381 373
@@ -386,7 +378,7 @@ void ufs_truncate (struct inode * inode)
386 struct ufs_sb_private_info * uspi; 378 struct ufs_sb_private_info * uspi;
387 int retry; 379 int retry;
388 380
389 UFSD(("ENTER\n")) 381 UFSD("ENTER\n");
390 sb = inode->i_sb; 382 sb = inode->i_sb;
391 uspi = UFS_SB(sb)->s_uspi; 383 uspi = UFS_SB(sb)->s_uspi;
392 384
@@ -417,5 +409,5 @@ void ufs_truncate (struct inode * inode)
417 ufsi->i_lastfrag = DIRECT_FRAGMENT; 409 ufsi->i_lastfrag = DIRECT_FRAGMENT;
418 unlock_kernel(); 410 unlock_kernel();
419 mark_inode_dirty(inode); 411 mark_inode_dirty(inode);
420 UFSD(("EXIT\n")) 412 UFSD("EXIT\n");
421} 413}
diff --git a/fs/ufs/util.c b/fs/ufs/util.c
index f9556bc484ef..4685f7cb70b2 100644
--- a/fs/ufs/util.c
+++ b/fs/ufs/util.c
@@ -14,15 +14,6 @@
14#include "swab.h" 14#include "swab.h"
15#include "util.h" 15#include "util.h"
16 16
17#undef UFS_UTILS_DEBUG
18
19#ifdef UFS_UTILS_DEBUG
20#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
21#else
22#define UFSD(x)
23#endif
24
25
26struct ufs_buffer_head * _ubh_bread_ (struct ufs_sb_private_info * uspi, 17struct ufs_buffer_head * _ubh_bread_ (struct ufs_sb_private_info * uspi,
27 struct super_block *sb, u64 fragment, u64 size) 18 struct super_block *sb, u64 fragment, u64 size)
28{ 19{
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index 48394dae225d..28b31591f688 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -220,6 +220,19 @@ typedef __u16 __bitwise __fs16;
220 */ 220 */
221#define UFS_MINFREE 5 221#define UFS_MINFREE 5
222#define UFS_DEFAULTOPT UFS_OPTTIME 222#define UFS_DEFAULTOPT UFS_OPTTIME
223
224/*
225 * Debug code
226 */
227#ifdef CONFIG_UFS_DEBUG
228# define UFSD(f, a...) { \
229 printk ("UFSD (%s, %d): %s:", \
230 __FILE__, __LINE__, __FUNCTION__); \
231 printk (f, ## a); \
232 }
233#else
234# define UFSD(f, a...) /**/
235#endif
223 236
224/* 237/*
225 * Turn file system block numbers into disk block addresses. 238 * Turn file system block numbers into disk block addresses.