public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [JFFS2] Cleanup the debugging stuff
@ 2005-07-17 10:10 Thomas Gleixner
  2005-07-17 10:30 ` Artem B. Bityuckiy
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2005-07-17 10:10 UTC (permalink / raw)
  To: Artem B. Bityuckiy; +Cc: MTD

> Move most of debugging-related JFFS2 stuff to debug.c and debug.h. It is much
> tidier then the previous approach. Preserve dwmw2's favourite D1() - I would
> like to clean-up them as well, but do not dare. :-)
> 

Why not ? I prefer a coherent cleanup over some halfarsed attempt.

>  	D1(printk(KERN_DEBUG "Scanned flash completely\n"));

Whats wrong with 

jffs2_dbg1_msg("Scanned flash completely\n"); ?

All those D1 messages should have KERN_DEBUG syslog level, so its simple
to wrap them nicely.

> -	D2(jffs2_dump_block_lists(c));
> +	D2(jffs2_dbg_dump_block_lists(c));

Why D2() here ? jffs2_dbg2_dump_block_lists(c) removes D2() and provides
a quick association to the debug level.

tglx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [JFFS2] Cleanup the debugging stuff
  2005-07-17 10:10 [JFFS2] Cleanup the debugging stuff Thomas Gleixner
@ 2005-07-17 10:30 ` Artem B. Bityuckiy
  2005-07-17 10:47   ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Artem B. Bityuckiy @ 2005-07-17 10:30 UTC (permalink / raw)
  To: tglx; +Cc: MTD

Thomas Gleixner wrote:
> Why not ? I prefer a coherent cleanup over some halfarsed attempt.
> 	D1(printk(KERN_DEBUG "Scanned flash completely\n"));
> Whats wrong with 
> jffs2_dbg1_msg("Scanned flash completely\n"); ?
> 
> All those D1 messages should have KERN_DEBUG syslog level, so its simple
> to wrap them nicely.
... and sometimes one may need to print current->pid at the debugging 
messages prefix...
Well, if dwmw2 agrees with this, I may do this when I have time.

>-	D2(jffs2_dump_block_lists(c));
>+	D2(jffs2_dbg_dump_block_lists(c));
> 
> Why D2() here ? jffs2_dbg2_dump_block_lists(c) removes D2() and provides
> a quick association to the debug level.
> 
I decided to make "paranoia" checks checks independent on the debug 
level. I.e., one may enable JFFS2 "paranoia" check without enabling 
JFFS2 debugging messages - this is often useful.

In turn, "paranoia" functions use "dump" functions, for example:

jffs2_dbg_fragtree_paranoia_check() uses jffs2_dbg_dump_fragtree();
jffs2_dbg_prewrite_paranoia_check() uses jffs2_dbg_dump_buffer();
etc.

So, as "paranoia" functions do not depend on the debug level, "dump" 
functions should not depend on it as well. jffs2_dbg_dump_block_lists() 
is also a "dump" function and I did not make "a quick association" for 
it. It allows me to have debug level 0 and at the same "paranoia" checks 
enabled.

But for "paranoia" functions I made the "quick association", so no Dx() 
is needed when you call, say, jffs2_dbg_fragtree_paranoia_check().

-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [JFFS2] Cleanup the debugging stuff
  2005-07-17 10:30 ` Artem B. Bityuckiy
@ 2005-07-17 10:47   ` Thomas Gleixner
  2005-07-17 10:51     ` Artem B. Bityuckiy
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2005-07-17 10:47 UTC (permalink / raw)
  To: Artem B. Bityuckiy; +Cc: MTD

On Sun, 2005-07-17 at 14:30 +0400, Artem B. Bityuckiy wrote:
> > All those D1 messages should have KERN_DEBUG syslog level, so its simple
> > to wrap them nicely.
> ... and sometimes one may need to print current->pid at the debugging 
> messages prefix...

? jffs2_dgb1_msg("Bla: %d. Message\n", current->pid);

> In turn, "paranoia" functions use "dump" functions, for example:
> 
> jffs2_dbg_fragtree_paranoia_check() uses jffs2_dbg_dump_fragtree();
> jffs2_dbg_prewrite_paranoia_check() uses jffs2_dbg_dump_buffer();
> etc.
> 
> So, as "paranoia" functions do not depend on the debug level, "dump" 
> functions should not depend on it as well. jffs2_dbg_dump_block_lists() 
> is also a "dump" function and I did not make "a quick association" for 
> it. It allows me to have debug level 0 and at the same "paranoia" checks 
> enabled.
> 
> But for "paranoia" functions I made the "quick association", so no Dx() 
> is needed when you call, say, jffs2_dbg_fragtree_paranoia_check().

Remove all the Dx() crap or none. This is more mess than before. You can
achieve all this by defining the macros correct

#if DBGLEVEL > 1
#define jffs2_dbg2_dump_whatever jff2_dbg_dmp_whatever
#else
#define jffs2_dbg2_dump_whatever do {} while(0)
#endif

#if DBGLEVEL > 1 || PARANOIA > 0
extern void jffs2_dbg_dump_whatever(arg);
#else
#define jffs2_dbg_dump_whatever do {} while(0)
#endif

tglx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [JFFS2] Cleanup the debugging stuff
  2005-07-17 10:47   ` Thomas Gleixner
@ 2005-07-17 10:51     ` Artem B. Bityuckiy
  0 siblings, 0 replies; 4+ messages in thread
From: Artem B. Bityuckiy @ 2005-07-17 10:51 UTC (permalink / raw)
  To: tglx; +Cc: Artem B. Bityuckiy, MTD

On Sun, 2005-07-17 at 12:47 +0200, Thomas Gleixner wrote: 
> ? jffs2_dgb1_msg("Bla: %d. Message\n", current->pid);
What I wanted to say that it is easier to re-define jffs2_dgb1_msg then
to change all jffs2_dgb1_msg() invocations. With current Dx() it is not
very easy to do thins cleanly. So, I vote for changing Dx() on
jffs2_dgb1_msg().

> Remove all the Dx() crap or none. This is more mess than before. You can
> achieve all this by defining the macros correct
ok.

-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-07-17 10:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-17 10:10 [JFFS2] Cleanup the debugging stuff Thomas Gleixner
2005-07-17 10:30 ` Artem B. Bityuckiy
2005-07-17 10:47   ` Thomas Gleixner
2005-07-17 10:51     ` Artem B. Bityuckiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox