mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] f2fs: convert to use sysfs_emit
@ 2023-03-31 11:33 Yangtao Li
  2023-04-05  2:44 ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Yangtao Li @ 2023-03-31 11:33 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: Yangtao Li, linux-f2fs-devel, linux-kernel

Let's use sysfs_emit.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/f2fs/sysfs.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 9ddc6ee19433..2c0b2cb05a3a 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -312,19 +312,13 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
 
 	if (!strcmp(a->attr.name, "ckpt_thread_ioprio")) {
 		struct ckpt_req_control *cprc = &sbi->cprc_info;
-		int len = 0;
 		int class = IOPRIO_PRIO_CLASS(cprc->ckpt_thread_ioprio);
 		int data = IOPRIO_PRIO_DATA(cprc->ckpt_thread_ioprio);
 
-		if (class == IOPRIO_CLASS_RT)
-			len += scnprintf(buf + len, PAGE_SIZE - len, "rt,");
-		else if (class == IOPRIO_CLASS_BE)
-			len += scnprintf(buf + len, PAGE_SIZE - len, "be,");
-		else
+		if (class != IOPRIO_CLASS_RT && class != IOPRIO_CLASS_BE)
 			return -EINVAL;
 
-		len += scnprintf(buf + len, PAGE_SIZE - len, "%d\n", data);
-		return len;
+		return sysfs_emit(buf, "%s,%d\n", class == IOPRIO_CLASS_RT ? "rt" : "be", data);
 	}
 
 #ifdef CONFIG_F2FS_FS_COMPRESSION
-- 
2.35.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] f2fs: convert to use sysfs_emit
  2023-03-31 11:33 [PATCH] f2fs: convert to use sysfs_emit Yangtao Li
@ 2023-04-05  2:44 ` Chao Yu
  2023-04-05 15:57   ` Jaegeuk Kim
  0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2023-04-05  2:44 UTC (permalink / raw)
  To: Yangtao Li, Jaegeuk Kim; +Cc: linux-f2fs-devel, linux-kernel

On 2023/3/31 19:33, Yangtao Li wrote:
> Let's use sysfs_emit.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>   fs/f2fs/sysfs.c | 10 ++--------
>   1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 9ddc6ee19433..2c0b2cb05a3a 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -312,19 +312,13 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
>   
>   	if (!strcmp(a->attr.name, "ckpt_thread_ioprio")) {
>   		struct ckpt_req_control *cprc = &sbi->cprc_info;
> -		int len = 0;
>   		int class = IOPRIO_PRIO_CLASS(cprc->ckpt_thread_ioprio);
>   		int data = IOPRIO_PRIO_DATA(cprc->ckpt_thread_ioprio);
>   
> -		if (class == IOPRIO_CLASS_RT)
> -			len += scnprintf(buf + len, PAGE_SIZE - len, "rt,");
> -		else if (class == IOPRIO_CLASS_BE)
> -			len += scnprintf(buf + len, PAGE_SIZE - len, "be,");
> -		else
> +		if (class != IOPRIO_CLASS_RT && class != IOPRIO_CLASS_BE)
>   			return -EINVAL;
>   
> -		len += scnprintf(buf + len, PAGE_SIZE - len, "%d\n", data);
> -		return len;
> +		return sysfs_emit(buf, "%s,%d\n", class == IOPRIO_CLASS_RT ? "rt" : "be", data);

Exceed 80 columns.

Thanks,

>   	}
>   
>   #ifdef CONFIG_F2FS_FS_COMPRESSION

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] f2fs: convert to use sysfs_emit
  2023-04-05  2:44 ` Chao Yu
@ 2023-04-05 15:57   ` Jaegeuk Kim
  2023-04-07  1:20     ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Jaegeuk Kim @ 2023-04-05 15:57 UTC (permalink / raw)
  To: Chao Yu; +Cc: Yangtao Li, linux-f2fs-devel, linux-kernel

On 04/05, Chao Yu wrote:
> On 2023/3/31 19:33, Yangtao Li wrote:
> > Let's use sysfs_emit.
> > 
> > Signed-off-by: Yangtao Li <frank.li@vivo.com>
> > ---
> >   fs/f2fs/sysfs.c | 10 ++--------
> >   1 file changed, 2 insertions(+), 8 deletions(-)
> > 
> > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > index 9ddc6ee19433..2c0b2cb05a3a 100644
> > --- a/fs/f2fs/sysfs.c
> > +++ b/fs/f2fs/sysfs.c
> > @@ -312,19 +312,13 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
> >   	if (!strcmp(a->attr.name, "ckpt_thread_ioprio")) {
> >   		struct ckpt_req_control *cprc = &sbi->cprc_info;
> > -		int len = 0;
> >   		int class = IOPRIO_PRIO_CLASS(cprc->ckpt_thread_ioprio);
> >   		int data = IOPRIO_PRIO_DATA(cprc->ckpt_thread_ioprio);
> > -		if (class == IOPRIO_CLASS_RT)
> > -			len += scnprintf(buf + len, PAGE_SIZE - len, "rt,");
> > -		else if (class == IOPRIO_CLASS_BE)
> > -			len += scnprintf(buf + len, PAGE_SIZE - len, "be,");
> > -		else
> > +		if (class != IOPRIO_CLASS_RT && class != IOPRIO_CLASS_BE)
> >   			return -EINVAL;
> > -		len += scnprintf(buf + len, PAGE_SIZE - len, "%d\n", data);
> > -		return len;
> > +		return sysfs_emit(buf, "%s,%d\n", class == IOPRIO_CLASS_RT ? "rt" : "be", data);
> 
> Exceed 80 columns.

Fixed and applied.

> 
> Thanks,
> 
> >   	}
> >   #ifdef CONFIG_F2FS_FS_COMPRESSION

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] f2fs: convert to use sysfs_emit
  2023-04-05 15:57   ` Jaegeuk Kim
@ 2023-04-07  1:20     ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2023-04-07  1:20 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: Yangtao Li, linux-f2fs-devel, linux-kernel

On 2023/4/5 23:57, Jaegeuk Kim wrote:
> On 04/05, Chao Yu wrote:
>> On 2023/3/31 19:33, Yangtao Li wrote:
>>> Let's use sysfs_emit.
>>>
>>> Signed-off-by: Yangtao Li <frank.li@vivo.com>
>>> ---
>>>    fs/f2fs/sysfs.c | 10 ++--------
>>>    1 file changed, 2 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
>>> index 9ddc6ee19433..2c0b2cb05a3a 100644
>>> --- a/fs/f2fs/sysfs.c
>>> +++ b/fs/f2fs/sysfs.c
>>> @@ -312,19 +312,13 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
>>>    	if (!strcmp(a->attr.name, "ckpt_thread_ioprio")) {
>>>    		struct ckpt_req_control *cprc = &sbi->cprc_info;
>>> -		int len = 0;
>>>    		int class = IOPRIO_PRIO_CLASS(cprc->ckpt_thread_ioprio);
>>>    		int data = IOPRIO_PRIO_DATA(cprc->ckpt_thread_ioprio);
>>> -		if (class == IOPRIO_CLASS_RT)
>>> -			len += scnprintf(buf + len, PAGE_SIZE - len, "rt,");
>>> -		else if (class == IOPRIO_CLASS_BE)
>>> -			len += scnprintf(buf + len, PAGE_SIZE - len, "be,");
>>> -		else
>>> +		if (class != IOPRIO_CLASS_RT && class != IOPRIO_CLASS_BE)
>>>    			return -EINVAL;
>>> -		len += scnprintf(buf + len, PAGE_SIZE - len, "%d\n", data);
>>> -		return len;
>>> +		return sysfs_emit(buf, "%s,%d\n", class == IOPRIO_CLASS_RT ? "rt" : "be", data);
>>
>> Exceed 80 columns.
> 
> Fixed and applied.

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-07  1:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 11:33 [PATCH] f2fs: convert to use sysfs_emit Yangtao Li
2023-04-05  2:44 ` Chao Yu
2023-04-05 15:57   ` Jaegeuk Kim
2023-04-07  1:20     ` Chao Yu

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®