Re: [PATCH 2/9] ext4: Use pr_fmt and pr_<level>

From: Joe Perches
Date: Thu Mar 22 2012 - 13:42:32 EST


On Thu, 2012-03-22 at 18:02 +0100, Jiri Slaby wrote:
> On 03/20/2012 10:46 AM, Joe Perches wrote:
> > On Tue, 2012-03-20 at 10:25 +0100, Jiri Slaby wrote:
> >> On 03/20/2012 10:21 AM, Joe Perches wrote:
> >>> the ath5k pr_ conversion patches are to
> >>> standardize prefixes and to reduce code size by
> >>> centralizing tests.
> >> What is the "standard" prefix?
> > KBUILD_MODNAME
>
> Instead, we should switch as many printks to dev_* and similar as
> possible, right?

I believe logging message use should be selected
to be as specific as possible (from high to low):

o <subsystem>_<level>
o netif_<level>
o netdev_<level>
o dev_<level>
o pr_<level>
o printk(KERN_<LEVEL>

> They are standard and provide a good interface for
> extensions: one has a device to work with. This is something what pr_*
> does not offer.

I completely agree.

I'd like to see some new subsystem prefixes
created and used as well. Maybe:

fs_<level> (like Ted's ext4_<foo>)
io_<level> (scsi/ide/mtd)
mm_<level>

There are probably a few others like
cpu/video/sound that might be useful.

> Frankly, moving the debug code to a separate function should make the
> code rather faster. By moving the unlikely code out of the instruction
> cache.

I think it's better still to eliminate debug
code altogether via if (0) when reasonable
or use dynamic_debug (jump_tables) when
overall code size isn't an issue.

cheers, Joe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/