All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Bart Van Assche <Bart.VanAssche@sandisk.com>,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Cc: Jayamohan Kallickal <jayamohan.kallickal@avagotech.com>,
	Ketan Mukadam <ketan.mukadam@avagotech.com>,
	John Soni Jose <sony.john@avagotech.com>,
	"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/2] be2iscsi: Logging neatening
Date: Sun, 14 Aug 2016 09:24:03 -0700	[thread overview]
Message-ID: <1471191843.4075.39.camel@perches.com> (raw)
In-Reply-To: <BY2PR0201MB18626C631DE6E5D09121608181110@BY2PR0201MB1862.namprd02.prod.outlook.com>

On Sun, 2016-08-14 at 14:34 +0000, Bart Van Assche wrote:
> On 08/13/16 13:42, Joe Perches wrote:
> > Joe Perches (2):
> >   be2iscsi: Coalesce split strings and formats
> >   be2iscsi: Use a standard logging style
> Hello Joe,

Hello Bart.

> As one can see in be_main.h the "level" argument of macro beiscsi_log() 
> is ignored for log levels KERN_EMERG, KERN_ALERT, KERN_CRIT and
> KERN_ERR. So for these log levels beiscsi_log() is a synonym of 
> shost_printk(). Have you considered to replace beiscsi_log() with 
> shost_printk() for these log levels and additionally to change 
> beiscsi_log() for the other log levels into pr_debug()? pr_debug() 
> statements namely already can be enabled and disabled at runtime. If the 
> BEISCSI_LOG_* log category would be embedded in the log text that would 
> allow to eliminate the phba->attr_log_enable structure member. 
> Additionally, pr_debug() has a facility for displaying the source file 
> name and the line number. That would allow to leave out __LINE__ from 
> be2iscsi log statements. I don't think it is useful to have that line 
> number in non-debug be2iscsi log statements.

My main consideration for submitting a patch at all
was removing the apparent format/argument mismatches.

As far as I can grep, only KERN_ERR, KERN_WARNING and
KERN_INFO are actually used by be2iscsi today.

I agree with the removal of __LINE__ from the macros
as its utility is generally pretty low.

Besides, using stringify(__LINE__) is almost always
smaller object code than a format with "%d", __LINE__.

Prefixes like "BC" and "BS" are __FILE__ equivalents,
and could be removed as well with something like
"%s, kbasename(__FILE__)" used if _really_ desired.

I have no issue with defining and using beiscsi_<level>
equivalents to shost_printks.

I think the test inside beiscsi_log is better removed
with multiple specific beiscsi_<level> calls used.

I don't know why any KERN_ERR should ever be masked,
but perhaps something like:

#define beiscsi_printk(level, phba, mask, fmt, ...)		\
do {								\
	if ((mask) & (phba)->attr_log_enable)			\
		shost_printk(level, phba->shost, fmt, ##__VA_ARGS__); \
} while (0)

#define beiscsi_err(phba, mask, fmt, ...)			\
	beiscsi_printk(KERN_ERR, phba, mask, fmt, ##__VA_ARGS__)
#define beiscsi_warn(phba, mask, fmt, ...)			\
	beiscsi_printk(KERN_WARNING, phba, mask, fmt, ##__VA_ARGS__)
#define beiscsi_info(phba, mask, fmt, ...)			\
	beiscsi_printk(KERN_INFO, phba, mask, fmt, ##__VA_ARGS__)

with a sed of the .c files:

$ sed -i 's/beiscsi_log(phba, KERN_ERR/beiscsi_err(phba/g' drivers/scsi/be2iscsi/*.c
$ sed -i 's/beiscsi_log(phba, KERN_WARNING/beiscsi_warn(phba/g' drivers/scsi/be2iscsi/*.c
$ sed -i 's/beiscsi_log(phba, KERN_INFO/beiscsi_info(phba/g' drivers/scsi/be2iscsi/*.c

with argument realignment of those lines.

All of these are of course up to the actual maintainers of be2iscsi.

  reply	other threads:[~2016-08-14 16:24 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12 10:02 [PATCH 2/2] be2iscsi: Fix some error messages Christophe JAILLET
2016-08-12 10:02 ` Christophe JAILLET
2016-08-12 10:30 ` Julia Lawall
2016-08-12 10:30   ` Julia Lawall
2016-08-12 20:30   ` Christophe JAILLET
2016-08-12 20:30     ` Christophe JAILLET
2016-08-13  7:08     ` [PATCH 2/2 v2] " Christophe JAILLET
2016-08-13  7:08       ` Christophe JAILLET
2016-08-13  7:14       ` Julia Lawall
2016-08-13  7:14         ` Julia Lawall
2016-08-13  7:20     ` [PATCH 2/2 v3] " Christophe JAILLET
2016-08-13  7:20       ` Christophe JAILLET
2016-08-13 11:35       ` Joe Perches
2016-08-13 11:35         ` Joe Perches
2016-08-13 12:31         ` Christophe JAILLET
2016-08-13 12:31           ` Christophe JAILLET
2016-08-13 16:41           ` Joe Perches
2016-08-13 16:41             ` Joe Perches
2016-08-13 17:03             ` Joe Perches
2016-08-13 17:03               ` Joe Perches
2016-08-13 20:42               ` [PATCH 0/2] be2iscsi: Logging neatening Joe Perches
2016-08-13 20:42                 ` [PATCH 1/2] be2iscsi: Coalesce split strings and formats Joe Perches
2016-08-13 20:42                 ` [PATCH 2/2] be2iscsi: Use a standard logging style Joe Perches
2016-08-14 14:34                 ` [PATCH 0/2] be2iscsi: Logging neatening Bart Van Assche
2016-08-14 16:24                   ` Joe Perches [this message]
2016-08-14 17:09                     ` Bart Van Assche
2016-08-14 17:29                       ` Joe Perches
2016-08-17  1:19                         ` Bart Van Assche
2016-08-17  3:39                           ` Joe Perches
2016-08-14 18:55                     ` [PATCH] be2iscsi: Use a more current logging style Joe Perches
2016-08-16  6:02                       ` Jitendra Bhivare
2016-08-16 10:27                         ` Joe Perches
2016-08-17  3:50                           ` Jitendra Bhivare
2016-08-17  3:59                             ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471191843.4075.39.camel@perches.com \
    --to=joe@perches.com \
    --cc=Bart.VanAssche@sandisk.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=jayamohan.kallickal@avagotech.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=ketan.mukadam@avagotech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sony.john@avagotech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.