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/truncate.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/truncate.c')
-rw-r--r-- | fs/ufs/truncate.c | 30 |
1 files changed, 11 insertions, 19 deletions
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 | } |