mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Gou Hao <gouhao@uniontech.com>, xiang@kernel.org, chao@kernel.org
Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	gouhaojake@163.com
Subject: Re: [PATCH 1/2] erofs: using macro instead of definition of log functions
Date: Thu, 17 Oct 2024 11:39:53 +0800	[thread overview]
Message-ID: <e5843bc0-4157-4bbb-908d-2997e95e6007@linux.alibaba.com> (raw)
In-Reply-To: <20241016152430.3456-1-gouhao@uniontech.com>

Hi Hao,

On 2024/10/16 23:24, Gou Hao wrote:
> No functional change intended.
> 
> Signed-off-by: Gou Hao <gouhao@uniontech.com>
> ---
>   fs/erofs/super.c | 51 ++++++++++++++++++------------------------------
>   1 file changed, 19 insertions(+), 32 deletions(-)
> 
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index 666873f745da..b04f888c8123 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -18,39 +18,26 @@
>   
>   static struct kmem_cache *erofs_inode_cachep __read_mostly;
>   
> -void _erofs_err(struct super_block *sb, const char *func, const char *fmt, ...)
> -{
> -	struct va_format vaf;
> -	va_list args;
> -
> -	va_start(args, fmt);
> -
> -	vaf.fmt = fmt;
> -	vaf.va = &args;
> -
> -	if (sb)
> -		pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
> -	else
> -		pr_err("%s: %pV", func, &vaf);
> -	va_end(args);
> -}
> -
> -void _erofs_info(struct super_block *sb, const char *func, const char *fmt, ...)
> -{
> -	struct va_format vaf;
> -	va_list args;
> -
> -	va_start(args, fmt);
> -
> -	vaf.fmt = fmt;
> -	vaf.va = &args;
> +#define _erofs_log_def(name) \
> +	void _erofs_##name(struct super_block *sb, const char *func, const char *fmt, ...) \
> +	{ \
> +		struct va_format vaf; \
> +		va_list args; \
> +		\
> +		va_start(args, (fmt)); \
> +		\
> +		vaf.fmt = (fmt); \
> +		vaf.va = &args; \
> +		\
> +		if ((sb)) \
> +			pr_##name("(device %s): %s: %pV", (sb)->s_id, (func), &vaf); \
> +		else \
> +			pr_##name("%s: %pV", (func), &vaf); \
> +		va_end(args); \
> +	}

Thanks for the patch!

Although code simplicity is quite important for EROFS, but
I'm not sure introducing unnecessary macro definitions (which
can be avoided) is better for code readability.

I wonder if we can put this into another way, like the current
_btrfs_printk() and _f2fs_printk() if we really need to work
on this.

Thanks,
Gao Xiang

      parent reply	other threads:[~2024-10-17  3:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 15:24 Gou Hao
2024-10-16 15:24 ` [PATCH 2/2] erofs: simplify declaration of the " Gou Hao
2024-10-17  3:42   ` Gao Xiang
2024-10-17  3:39 ` Gao Xiang [this message]

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=e5843bc0-4157-4bbb-908d-2997e95e6007@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=gouhao@uniontech.com \
    --cc=gouhaojake@163.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiang@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®