diff options
author | Evgeniy Dushistov <dushistov@mail.ru> | 2006-06-25 08:47:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:03 -0400 |
commit | abf5d15fd2e52517dd56a17a846d5a1f900b7db4 (patch) | |
tree | ea537760c201cea57b468044dc733e06781ece2b /fs/ufs/cylinder.c | |
parent | 5afb3145c9a733166174e1f5a07c46410b5c4091 (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/cylinder.c')
-rw-r--r-- | fs/ufs/cylinder.c | 31 |
1 files changed, 11 insertions, 20 deletions
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 | ||
79 | failed: | 70 | failed: |
@@ -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 | } |