Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp475214imn; Tue, 26 Jul 2022 00:20:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s/2f26+zlSVcqXVvJmxNK7YGbLs/+QlpNR/7rxBGhL7aI1j3WuCxix9JUQAVWhJ00wufop X-Received: by 2002:a05:6a00:2395:b0:52c:7db:efb0 with SMTP id f21-20020a056a00239500b0052c07dbefb0mr4516030pfc.17.1658820032032; Tue, 26 Jul 2022 00:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658820032; cv=none; d=google.com; s=arc-20160816; b=zRHYhk1um92eQ3Ld9AsU64hLmI/gtK3qJCEWr6md83mfwWqLVLXAfhppP71uOq1rfd qrtNiCG8H1XGlYS7Tp/yulnI7t6HRo9w54Hy5ac8Dcz8Nq2Y9O6cCDnDzU4ompA1b3ae pIuVFrFhWavQBBB7Oqz78zTio/5opCQ/kYAAsnC78vT8MBJoV8I36d43jXh9f6NWlWvp q/j17UYNrXB4xLmhaDo4kovj3dGyumbIxXeJfsh7B6faTKREPVYFHAGLkHGfjNl6oaN0 FgGbA6tk7JHJkxqafT8/Es0ZxXhzF9NJKuG8AHHzlPQN67vJO5D4jumLTSteV0kQ0vUB Dihw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:references :in-reply-to:mime-version:dkim-signature; bh=9UFr+bmaoTuIrjwaNI6w11HZNksVFszqpgT660MuU7M=; b=cpwbUbx+bEwDaOsMBiTmMRF551pWyU1dZCd5V5HX8d+d06CHLvaDRi1+QoM+8d+UHH SmihtsEDphjbTEOVHgWV6VLtdbHjKvLEIp/mnM1F4arx2jwE5oGKR3bd54apNMuT/IfE jeUz4rr5pSEnowNxw2N4vSVHYo0cWY+DgXkHxYZ6YA9tDFK+CKwLXFXDIaIgOqTau2GJ QjTeIEaX94FeJsGSMVHgija9wXg4DxkZe5Ff9pDpr1SlRlpMBrbqYv5zpaI0B+N4es65 338n2z24HGROdJN0yKbK1Q7sxOv17NuTtsc02dLMmKPFSMCuQLd5tBiBKpdhHf3SPS6m e1eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IHDEy8v9; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a63aa09000000b0040cb763766dsi15965029pgf.566.2022.07.26.00.20.16; Tue, 26 Jul 2022 00:20:32 -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=@kernel.org header.s=k20201202 header.b=IHDEy8v9; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232144AbiGZHCr (ORCPT + 99 others); Tue, 26 Jul 2022 03:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229796AbiGZHCo (ORCPT ); Tue, 26 Jul 2022 03:02:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2768411A19; Tue, 26 Jul 2022 00:02:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B127861374; Tue, 26 Jul 2022 07:02:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18445C341CD; Tue, 26 Jul 2022 07:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658818963; bh=go+bvXX6X7Grn7l+6nOhjY0anqvIAvVpR0lLJyna+kg=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=IHDEy8v9aVTJuqnkYAFN+DrknKc9EBq0T8+cRJHTDvRkUCpu6fQdx7r3+3TrOhfYw wejFAG/NDLaMV8ztTOt68ZQ62cIj7m5z8F+An+HxQi/ljVpqtEf5AMcxPcXPl+1jza AOoZF+uG8jbwV6qVe5Z++PWhCXBx5JyjuGxu9FCFBEvc1Nbo5Whx6qKh25lNVusxpU HiosIT0B+AvQ12yZ2+DUC9fVJyLStxxG1hJas/BygKpQVp7WZiobSRDx6nUSdUWzvH b4d2Ll+TYs63zyhb/ID+vKxWHCM+Mj/WDfw9lqYVmMX+KZLcEa5QVLap/AiCSxZG7Q 8HbJlOoBdnAnQ== Received: by mail-wr1-f53.google.com with SMTP id v13so11059665wru.12; Tue, 26 Jul 2022 00:02:42 -0700 (PDT) X-Gm-Message-State: AJIora+W/RaviDZd70ooh++WcvPT/GJIyTzU0e49gY503vSQOY3iAC2V 2hrtCjRvUVZlZkLnUipQckArjDQCuyE1D7kjxcs= X-Received: by 2002:a5d:6d0b:0:b0:21d:9f26:f84a with SMTP id e11-20020a5d6d0b000000b0021d9f26f84amr9862540wrq.155.1658818961280; Tue, 26 Jul 2022 00:02:41 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:adf:f7cb:0:0:0:0:0 with HTTP; Tue, 26 Jul 2022 00:02:40 -0700 (PDT) In-Reply-To: <87edyc2r2e.wl-tiwai@suse.de> References: <20220722142916.29435-1-tiwai@suse.de> <20220722142916.29435-4-tiwai@suse.de> <0350c21bcfdc896f2b912363f221958d41ebf1e1.camel@perches.com> <87edyc2r2e.wl-tiwai@suse.de> From: Namjae Jeon Date: Tue, 26 Jul 2022 16:02:40 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/4] exfat: Expand exfat_err() and co directly to pr_*() macro To: Takashi Iwai Cc: Joe Perches , linux-fsdevel@vger.kernel.org, Sungjong Seo , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 2022-07-23 17:04 GMT+09:00, Takashi Iwai : > 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. Joe has already said that he prefers the first. Will you send v2 patch-set ? Thanks! > >> 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 >