* [PATCH v2] erofs: make erofs_err() and erofs_info() support NULL sb parameter
@ 2024-01-02 15:01 Chunhai Guo via Linux-erofs
2024-01-02 15:10 ` Jingbo Xu
0 siblings, 1 reply; 4+ messages in thread
From: Chunhai Guo via Linux-erofs @ 2024-01-02 15:01 UTC (permalink / raw)
To: xiang; +Cc: Chunhai Guo, linux-erofs, huyue2
Make erofs_err() and erofs_info() support NULL sb parameter for more
general usage.
Suggested-by: Gao Xiang <xiang@kernel.org>
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
---
fs/erofs/super.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 3789d6224513..5f60f163bd56 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -27,7 +27,10 @@ void _erofs_err(struct super_block *sb, const char *func, const char *fmt, ...)
vaf.fmt = fmt;
vaf.va = &args;
- pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
+ if (sb)
+ pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
+ else
+ pr_err("%s: %pV", func, &vaf);
va_end(args);
}
@@ -41,7 +44,10 @@ void _erofs_info(struct super_block *sb, const char *func, const char *fmt, ...)
vaf.fmt = fmt;
vaf.va = &args;
- pr_info("(device %s): %pV", sb->s_id, &vaf);
+ if (sb)
+ pr_info("(device %s): %pV", sb->s_id, &vaf);
+ else
+ pr_info("%pV", &vaf);
va_end(args);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] erofs: make erofs_err() and erofs_info() support NULL sb parameter
2024-01-02 15:01 [PATCH v2] erofs: make erofs_err() and erofs_info() support NULL sb parameter Chunhai Guo via Linux-erofs
@ 2024-01-02 15:10 ` Jingbo Xu
2024-01-02 20:28 ` Gao Xiang
0 siblings, 1 reply; 4+ messages in thread
From: Jingbo Xu @ 2024-01-02 15:10 UTC (permalink / raw)
To: Chunhai Guo, xiang; +Cc: linux-erofs, huyue2
Hi Chunhai,
Thanks for the commit.
On 1/2/24 11:01 PM, Chunhai Guo wrote:
> Make erofs_err() and erofs_info() support NULL sb parameter for more
> general usage.
>
> Suggested-by: Gao Xiang <xiang@kernel.org>
> Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
> ---
> fs/erofs/super.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index 3789d6224513..5f60f163bd56 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -27,7 +27,10 @@ void _erofs_err(struct super_block *sb, const char *func, const char *fmt, ...)
> vaf.fmt = fmt;
> vaf.va = &args;
>
> - pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
> + if (sb)
> + pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
> + else
> + pr_err("%s: %pV", func, &vaf);
> va_end(args);
> }
>
> @@ -41,7 +44,10 @@ void _erofs_info(struct super_block *sb, const char *func, const char *fmt, ...)
> vaf.fmt = fmt;
> vaf.va = &args;
>
> - pr_info("(device %s): %pV", sb->s_id, &vaf);
> + if (sb)
> + pr_info("(device %s): %pV", sb->s_id, &vaf);
> + else
> + pr_info("%pV", &vaf);
> va_end(args);
> }
>
May I ask in which case the input sb parameter will be NULL? In that
case, why don't we call pr_err() or pr_info() directly?
--
Thanks,
Jingbo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] erofs: make erofs_err() and erofs_info() support NULL sb parameter
2024-01-02 15:10 ` Jingbo Xu
@ 2024-01-02 20:28 ` Gao Xiang
2024-01-03 4:13 ` Jingbo Xu
0 siblings, 1 reply; 4+ messages in thread
From: Gao Xiang @ 2024-01-02 20:28 UTC (permalink / raw)
To: Jingbo Xu, Chunhai Guo, xiang; +Cc: linux-erofs, huyue2
Hi Jingbo,
On 2024/1/2 23:10, Jingbo Xu wrote:
> Hi Chunhai,
>
> Thanks for the commit.
>
> On 1/2/24 11:01 PM, Chunhai Guo wrote:
>> Make erofs_err() and erofs_info() support NULL sb parameter for more
>> general usage.
>>
>> Suggested-by: Gao Xiang <xiang@kernel.org>
>> Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
>> ---
>> fs/erofs/super.c | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
>> index 3789d6224513..5f60f163bd56 100644
>> --- a/fs/erofs/super.c
>> +++ b/fs/erofs/super.c
>> @@ -27,7 +27,10 @@ void _erofs_err(struct super_block *sb, const char *func, const char *fmt, ...)
>> vaf.fmt = fmt;
>> vaf.va = &args;
>>
>> - pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
>> + if (sb)
>> + pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
>> + else
>> + pr_err("%s: %pV", func, &vaf);
>> va_end(args);
>> }
>>
>> @@ -41,7 +44,10 @@ void _erofs_info(struct super_block *sb, const char *func, const char *fmt, ...)
>> vaf.fmt = fmt;
>> vaf.va = &args;
>>
>> - pr_info("(device %s): %pV", sb->s_id, &vaf);
>> + if (sb)
>> + pr_info("(device %s): %pV", sb->s_id, &vaf);
>> + else
>> + pr_info("%pV", &vaf);
>> va_end(args);
>> }
>>
>
> May I ask in which case the input sb parameter will be NULL? In that
> case, why don't we call pr_err() or pr_info() directly?
That was my suggestion. erofs_err/info are widely used in the codebase
and they emit the final "\n" but pr_err/pr_info need to use "\n" in
contrast.
Combining these two usage might not quite good. Does it sound good to
you?
Also, it is worth converting the only one to erofs_err now.
decompressor_deflate.c: pr_err("failed to allocate zlib workspace\n");
THNKS,
GAO XIANG
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] erofs: make erofs_err() and erofs_info() support NULL sb parameter
2024-01-02 20:28 ` Gao Xiang
@ 2024-01-03 4:13 ` Jingbo Xu
0 siblings, 0 replies; 4+ messages in thread
From: Jingbo Xu @ 2024-01-03 4:13 UTC (permalink / raw)
To: Gao Xiang, Chunhai Guo, xiang; +Cc: linux-erofs, huyue2
On 1/3/24 4:28 AM, Gao Xiang wrote:
> Hi Jingbo,
>
> On 2024/1/2 23:10, Jingbo Xu wrote:
>> Hi Chunhai,
>>
>> Thanks for the commit.
>>
>> On 1/2/24 11:01 PM, Chunhai Guo wrote:
>>> Make erofs_err() and erofs_info() support NULL sb parameter for more
>>> general usage.
>>>
>>> Suggested-by: Gao Xiang <xiang@kernel.org>
>>> Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
>>> ---
>>> fs/erofs/super.c | 10 ++++++++--
>>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
>>> index 3789d6224513..5f60f163bd56 100644
>>> --- a/fs/erofs/super.c
>>> +++ b/fs/erofs/super.c
>>> @@ -27,7 +27,10 @@ void _erofs_err(struct super_block *sb, const char
>>> *func, const char *fmt, ...)
>>> vaf.fmt = fmt;
>>> vaf.va = &args;
>>> - pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
>>> + if (sb)
>>> + pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
>>> + else
>>> + pr_err("%s: %pV", func, &vaf);
>>> va_end(args);
>>> }
>>> @@ -41,7 +44,10 @@ void _erofs_info(struct super_block *sb, const
>>> char *func, const char *fmt, ...)
>>> vaf.fmt = fmt;
>>> vaf.va = &args;
>>> - pr_info("(device %s): %pV", sb->s_id, &vaf);
>>> + if (sb)
>>> + pr_info("(device %s): %pV", sb->s_id, &vaf);
>>> + else
>>> + pr_info("%pV", &vaf);
>>> va_end(args);
>>> }
>>>
>>
>> May I ask in which case the input sb parameter will be NULL? In that
>> case, why don't we call pr_err() or pr_info() directly?
>
> That was my suggestion. erofs_err/info are widely used in the codebase
> and they emit the final "\n" but pr_err/pr_info need to use "\n" in
> contrast.
>
> Combining these two usage might not quite good. Does it sound good to
> you?
>
> Also, it is worth converting the only one to erofs_err now.
> decompressor_deflate.c: pr_err("failed to allocate zlib workspace\n");
>
> THNKS,
> GAO XIANG
Thanks. LGTM.
Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>
--
Thanks,
Jingbo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-03 4:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02 15:01 [PATCH v2] erofs: make erofs_err() and erofs_info() support NULL sb parameter Chunhai Guo via Linux-erofs
2024-01-02 15:10 ` Jingbo Xu
2024-01-02 20:28 ` Gao Xiang
2024-01-03 4:13 ` Jingbo Xu
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.