From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753226AbcHNQYJ (ORCPT ); Sun, 14 Aug 2016 12:24:09 -0400 Received: from smtprelay0148.hostedemail.com ([216.40.44.148]:57947 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753144AbcHNQYH (ORCPT ); Sun, 14 Aug 2016 12:24:07 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:421:541:599:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3355:3622:3653:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:5007:6119:6691:7808:7903:8828:9389:10004:10400:10848:11026:11232:11657:11658:11914:12043:12050:12296:12517:12519:12740:13071:13160:13229:13439:13894:14180:14659:14721:21080:21433:21451:30012:30029:30034:30054:30064:30070:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: crowd63_7adb9172da356 X-Filterd-Recvd-Size: 4243 Message-ID: <1471191843.4075.39.camel@perches.com> Subject: Re: [PATCH 0/2] be2iscsi: Logging neatening From: Joe Perches To: Bart Van Assche , Christophe JAILLET , "linux-scsi@vger.kernel.org" Cc: Jayamohan Kallickal , Ketan Mukadam , John Soni Jose , "James E.J. Bottomley" , "Martin K. Petersen" , "linux-kernel@vger.kernel.org" Date: Sun, 14 Aug 2016 09:24:03 -0700 In-Reply-To: References: <1471107782.3467.28.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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_ equivalents to shost_printks. I think the test inside beiscsi_log is better removed with multiple specific beiscsi_ 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.