Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp1302998imi; Sat, 23 Jul 2022 01:26:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tSKC4MqKYtyORvNRz2f9nDPDoKLo/tusSRCjBjl+oe+1xA33ai/gbAPkgLtHSypEt9a6Gb X-Received: by 2002:a17:907:1629:b0:72b:68e9:bf2c with SMTP id hb41-20020a170907162900b0072b68e9bf2cmr2827140ejc.760.1658564795157; Sat, 23 Jul 2022 01:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658564795; cv=none; d=google.com; s=arc-20160816; b=AsLBsNKU3es9JHJB9Za5sq61tT1kpNj8wowrF7ZWB9XR2naaTaqLceiNBfaRfDra23 4jjzs+LEDc5TmRqJF/cwNIYaNg67NnVqt1fvdN5l/JQJyFWLzl40UEj8MQwxl/1C1+O0 Cf9rUWFkDhnKZXJa/0gmvwR1qGB6i9om+pBs/nb8VYClLtJxgoOYjAGOg97+F3tuQH/s QPzskw3wwM5nqoc4lX+LsFnlq3V9DxhOp+fH63gas9huFJx+/LM0/053dJErAe6O0d/c vRky/1I8Klk7Cg4LOvpDIxNYQNaWX2qc0NHG3rhv5ykGX72O19rVmVsbuc1iL+6lDH7T 7nkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=Y9QhawCkHKsCiHHgfi8GWHnlEnHkEPLxtn8NZEM6LSY=; b=SDRQ6doj3mHiLOdwv6xrOxQ1YxGQk8XQfbnIUMcYjtkNZBUks1uCdNyoDKAFvIiPcb BQZvZIAuM4cwQv36w0GEswwgI6XnPbd2kjWfcydzUA1yLF+fh87YUrNtwXjFCzrzOjlQ 7EXGelmE4wiMi8DUKNoUp9ISyn6sQ+9pumBmUwRYmsIwsw21VywReuz8MJFzqe0dfIie Ehu8j+PQfmVNBrUUrehEV6UjBfDZdpYV6tSuN8HBqj996fjiDd4+2WNok2O5bFRfk+6h cF2UCrKx1xjM6G+fqOjs8Fz4+WF1LXvI+yIyb4RSlvnz/WvDqxHFCBET9nWuL8XAKT3A GdRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="utorI0k/"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m12-20020a056402510c00b004379c601345si9279650edd.569.2022.07.23.01.25.40; Sat, 23 Jul 2022 01:26:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="utorI0k/"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236251AbiGWIEO (ORCPT + 99 others); Sat, 23 Jul 2022 04:04:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230217AbiGWIEM (ORCPT ); Sat, 23 Jul 2022 04:04:12 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 493BD15FE1; Sat, 23 Jul 2022 01:04:11 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BC130386FE; Sat, 23 Jul 2022 08:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658563449; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y9QhawCkHKsCiHHgfi8GWHnlEnHkEPLxtn8NZEM6LSY=; b=utorI0k/pk3RICH03mAA2PG7LoWXNki4Wi1Qrk/0iwrxbkp9KhsQGOSD8WnSbqQP1yXRac +zqoKEL7F2e3viCe4EZrqmtlj6sbUspVcOiNzX5XJiUopUp3uW7vSv06RSGtkOhrRgsnxO vm4e2/vgXM3oym6T5QsC0/SaOrV4Iac= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658563449; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y9QhawCkHKsCiHHgfi8GWHnlEnHkEPLxtn8NZEM6LSY=; b=te239ay+Rhoi2TvqvwNKOjFkS/95RSnnF7C5ErBWDMbKuwQrCOFht9hnIUwhMdwjmHFzu0 XD3j5amzFiiJAmCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 95BB913A92; Sat, 23 Jul 2022 08:04:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IqbJI3mr22IyFAAAMHmgww (envelope-from ); Sat, 23 Jul 2022 08:04:09 +0000 Date: Sat, 23 Jul 2022 10:04:09 +0200 Message-ID: <87edyc2r2e.wl-tiwai@suse.de> From: Takashi Iwai To: Joe Perches Cc: linux-fsdevel@vger.kernel.org, Namjae Jeon , Sungjong Seo , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] exfat: Expand exfat_err() and co directly to pr_*() macro In-Reply-To: <0350c21bcfdc896f2b912363f221958d41ebf1e1.camel@perches.com> References: <20220722142916.29435-1-tiwai@suse.de> <20220722142916.29435-4-tiwai@suse.de> <0350c21bcfdc896f2b912363f221958d41ebf1e1.camel@perches.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 23 Jul 2022 09:42:12 +0200, Joe Perches wrote: > > On Fri, 2022-07-22 at 16:29 +0200, Takashi Iwai wrote: > > Currently the error and info messages handled by exfat_err() and co > > are tossed to exfat_msg() function that does nothing but passes the > > strings with printk() invocation. Not only that this is more overhead > > by the indirect calls, but also this makes harder to extend for the > > debug print usage; because of the direct printk() call, you cannot > > make it for dynamic debug or without debug like the standard helpers > > such as pr_debug() or dev_dbg(). > > > > For addressing the problem, this patch replaces exfat_msg() function > > with a macro to expand to pr_*() directly. This allows us to create > > exfat_debug() macro that is expanded to pr_debug() (which output can > > gracefully suppressed via dyndbg). > [] > > diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h > [] > > @@ -508,14 +508,19 @@ void __exfat_fs_error(struct super_block *sb, int report, const char *fmt, ...) > > #define exfat_fs_error_ratelimit(sb, fmt, args...) \ > > __exfat_fs_error(sb, __ratelimit(&EXFAT_SB(sb)->ratelimit), \ > > fmt, ## args) > > -void exfat_msg(struct super_block *sb, const char *lv, const char *fmt, ...) > > - __printf(3, 4) __cold; > > + > > +/* expand to pr_xxx() with prefix */ > > +#define exfat_msg(sb, lv, fmt, ...) \ > > + pr_##lv("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__) > > + > > #define exfat_err(sb, fmt, ...) \ > > - exfat_msg(sb, KERN_ERR, fmt, ##__VA_ARGS__) > > + exfat_msg(sb, err, fmt, ##__VA_ARGS__) > > #define exfat_warn(sb, fmt, ...) \ > > - exfat_msg(sb, KERN_WARNING, fmt, ##__VA_ARGS__) > > + exfat_msg(sb, warn, fmt, ##__VA_ARGS__) > > #define exfat_info(sb, fmt, ...) \ > > - exfat_msg(sb, KERN_INFO, fmt, ##__VA_ARGS__) > > + exfat_msg(sb, info, fmt, ##__VA_ARGS__) > > +#define exfat_debug(sb, fmt, ...) \ > > + exfat_msg(sb, debug, fmt, ##__VA_ARGS__) > > I think this would be clearer using pr_ directly instead > of an indirecting macro that uses concatenation of that > obscures the actual use of pr_ > > Either: (and this first option would be my preference) > > #define exfat_err(sb, fmt, ...) \ > pr_err("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__) > #define exfat_warn(sb, fmt, ...) \ > pr_warn("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__) > etc... IMO, it's a matter of taste, and I don't mind either way. Just let me know. > or using an indirecting macro: > > #define exfat_printk(pr_level, sb, fmt, ...) \ > pr_level("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__) Is pr_level() defined anywhere...? > > and btw, there are multiple uses of exfat_ output with a > unnecessary and duplicated '\n' that the macro already adds that > should be removed: > > $ git grep -P -n '\bexfat_(err|warn|info).*\\n' fs/exfat/ > fs/exfat/fatent.c:334: exfat_err(sb, "sbi->clu_srch_ptr is invalid (%u)\n", > fs/exfat/nls.c:674: exfat_err(sb, "failed to read sector(0x%llx)\n", > fs/exfat/super.c:467: exfat_err(sb, "bogus sector size bits : %u\n", > fs/exfat/super.c:476: exfat_err(sb, "bogus sectors bits per cluster : %u\n", Right, that should be addressed in another patch. thanks, Takashi