Re: [PATCH v4] mtd: ubi: Extend UBI layer debug/messaging capabilities

Joe Perches
2014-10-20T17:30:07Z

On Mon, 2014-10-20 at 19:54 +0300, Tanya Brokhman wrote:
> On 10/20/2014 4:51 PM, Artem Bityutskiy wrote:
> > On Tue, 2014-10-14 at 09:05 -0700, Joe Perches wrote:
> >> It's pretty trivial when all the lines are already
> >> being touched.
> >
> > OK, but then the same change should done in UBIFS, because it's
> > ubifs_msg() and so on macros are consistent with UBI macros. So I think
> > if this is done, then it is done separately for both UBI and UBIFS.
[]
> We have similar patch for ubifs as well, one that adds ubi number to all
> ubifs messages. We just didn't get to sharing it yet.

[]

> I prefer not adding the "\n" to my patch unless Artem insists on it.

I tested a nearly completely automated conversion to use
functions ad %pV for ubifs_err/ubifs_warn while adding
'\n' to the uses. (converted ubifs_msg to ubifs_notice too)

It reduces the object size a couple percent.
(allyesconfig)

$ size fs/ubifs/built-in.o*
text data bss dec hex filename
335548 66040 138064 539652 83c04 fs/ubifs/built-in.o.new
353362 65912 138000 557274 880da fs/ubifs/built-in.o.old

It's not any real quantity of work to redo after you
post your patch.

There are a few defects today with unnecessary newlines
with ubifs_<level> uses.

$ git grep -P '\bubifs_\w+\s*.*\\n' 062a08d6ad56da23209083748ea5e0f1ab65a0e7 -- fs/ubifs/
062a08d6ad56da23209083748ea5e0f1ab65a0e7:fs/ubifs/debug.c: ubifs_msg("first node at %d:%d\n", zbr1->lnum, zbr1->offs);
062a08d6ad56da23209083748ea5e0f1ab65a0e7:fs/ubifs/debug.c: ubifs_msg("second node at %d:%d\n", zbr2->lnum, zbr2->offs);
062a08d6ad56da23209083748ea5e0f1ab65a0e7:fs/ubifs/debug.c: ubifs_err("cannot create \"%s\" debugfs file or directory, error %d\n",
062a08d6ad56da23209083748ea5e0f1ab65a0e7:fs/ubifs/debug.c: ubifs_err("cannot create \"%s\" debugfs file or directory, error %d\n",

Some with pr_<level> uses too.