LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] f2fs: add a way to turn off ipu bio cache
@ 2020-01-07  2:07 Jaegeuk Kim
  2020-01-08  7:59 ` [f2fs-dev] " Chao Yu
  0 siblings, 1 reply; 6+ messages in thread
From: Jaegeuk Kim @ 2020-01-07  2:07 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

Setting 0x40 in /sys/fs/f2fs/dev/ipu_policy gives a way to turn off
bio cache, which is useufl to check whether block layer using hardware
encryption engine merges IOs correctly.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 Documentation/filesystems/f2fs.txt | 1 +
 fs/f2fs/segment.c                  | 2 +-
 fs/f2fs/segment.h                  | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
index 41b5aa94b30f..cd93bcc34726 100644
--- a/Documentation/filesystems/f2fs.txt
+++ b/Documentation/filesystems/f2fs.txt
@@ -335,6 +335,7 @@ Files in /sys/fs/f2fs/<devname>
                                0x01: F2FS_IPU_FORCE, 0x02: F2FS_IPU_SSR,
                                0x04: F2FS_IPU_UTIL,  0x08: F2FS_IPU_SSR_UTIL,
                                0x10: F2FS_IPU_FSYNC.
+			       0x40: F2FS_IPU_NOCACHE disables bio caches.
 
  min_ipu_util                 This parameter controls the threshold to trigger
                               in-place-updates. The number indicates percentage
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index a9519532c029..311fe4937f6a 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3289,7 +3289,7 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
 
 	stat_inc_inplace_blocks(fio->sbi);
 
-	if (fio->bio)
+	if (fio->bio && !(SM_I(sbi)->ipu_policy & (1 << F2FS_IPU_NOCACHE)))
 		err = f2fs_merge_page_bio(fio);
 	else
 		err = f2fs_submit_page_bio(fio);
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index a1b3951367cd..02e620470eef 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -623,6 +623,7 @@ enum {
 	F2FS_IPU_SSR_UTIL,
 	F2FS_IPU_FSYNC,
 	F2FS_IPU_ASYNC,
+	F2FS_IPU_NOCACHE,
 };
 
 static inline unsigned int curseg_segno(struct f2fs_sb_info *sbi,
-- 
2.24.0.525.g8f36a354ae-goog


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

* Re: [f2fs-dev] [PATCH] f2fs: add a way to turn off ipu bio cache
  2020-01-07  2:07 [PATCH] f2fs: add a way to turn off ipu bio cache Jaegeuk Kim
@ 2020-01-08  7:59 ` Chao Yu
  2020-01-08 12:04   ` Jaegeuk Kim
  0 siblings, 1 reply; 6+ messages in thread
From: Chao Yu @ 2020-01-08  7:59 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2020/1/7 10:07, Jaegeuk Kim wrote:
> Setting 0x40 in /sys/fs/f2fs/dev/ipu_policy gives a way to turn off
> bio cache, which is useufl to check whether block layer using hardware
> encryption engine merges IOs correctly.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  Documentation/filesystems/f2fs.txt | 1 +
>  fs/f2fs/segment.c                  | 2 +-
>  fs/f2fs/segment.h                  | 1 +
>  3 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
> index 41b5aa94b30f..cd93bcc34726 100644
> --- a/Documentation/filesystems/f2fs.txt
> +++ b/Documentation/filesystems/f2fs.txt
> @@ -335,6 +335,7 @@ Files in /sys/fs/f2fs/<devname>
>                                 0x01: F2FS_IPU_FORCE, 0x02: F2FS_IPU_SSR,
>                                 0x04: F2FS_IPU_UTIL,  0x08: F2FS_IPU_SSR_UTIL,
>                                 0x10: F2FS_IPU_FSYNC.

. -> ,

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> +			       0x40: F2FS_IPU_NOCACHE disables bio caches.
>  
>   min_ipu_util                 This parameter controls the threshold to trigger
>                                in-place-updates. The number indicates percentage
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index a9519532c029..311fe4937f6a 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -3289,7 +3289,7 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
>  
>  	stat_inc_inplace_blocks(fio->sbi);
>  
> -	if (fio->bio)
> +	if (fio->bio && !(SM_I(sbi)->ipu_policy & (1 << F2FS_IPU_NOCACHE)))
>  		err = f2fs_merge_page_bio(fio);
>  	else
>  		err = f2fs_submit_page_bio(fio);
> diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
> index a1b3951367cd..02e620470eef 100644
> --- a/fs/f2fs/segment.h
> +++ b/fs/f2fs/segment.h
> @@ -623,6 +623,7 @@ enum {
>  	F2FS_IPU_SSR_UTIL,
>  	F2FS_IPU_FSYNC,
>  	F2FS_IPU_ASYNC,
> +	F2FS_IPU_NOCACHE,
>  };
>  
>  static inline unsigned int curseg_segno(struct f2fs_sb_info *sbi,
> 

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

* Re: [f2fs-dev] [PATCH] f2fs: add a way to turn off ipu bio cache
  2020-01-08  7:59 ` [f2fs-dev] " Chao Yu
@ 2020-01-08 12:04   ` Jaegeuk Kim
  2020-01-08 12:23     ` Chao Yu
  0 siblings, 1 reply; 6+ messages in thread
From: Jaegeuk Kim @ 2020-01-08 12:04 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 01/08, Chao Yu wrote:
> On 2020/1/7 10:07, Jaegeuk Kim wrote:
> > Setting 0x40 in /sys/fs/f2fs/dev/ipu_policy gives a way to turn off
> > bio cache, which is useufl to check whether block layer using hardware
> > encryption engine merges IOs correctly.
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  Documentation/filesystems/f2fs.txt | 1 +
> >  fs/f2fs/segment.c                  | 2 +-
> >  fs/f2fs/segment.h                  | 1 +
> >  3 files changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
> > index 41b5aa94b30f..cd93bcc34726 100644
> > --- a/Documentation/filesystems/f2fs.txt
> > +++ b/Documentation/filesystems/f2fs.txt
> > @@ -335,6 +335,7 @@ Files in /sys/fs/f2fs/<devname>
> >                                 0x01: F2FS_IPU_FORCE, 0x02: F2FS_IPU_SSR,
> >                                 0x04: F2FS_IPU_UTIL,  0x08: F2FS_IPU_SSR_UTIL,
> >                                 0x10: F2FS_IPU_FSYNC.
> 
> . -> ,

Actually, we can't do it. I revised it a bit instead.

> 
> Reviewed-by: Chao Yu <yuchao0@huawei.com>
> 
> Thanks,
> 
> > +			       0x40: F2FS_IPU_NOCACHE disables bio caches.
> >  
> >   min_ipu_util                 This parameter controls the threshold to trigger
> >                                in-place-updates. The number indicates percentage
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index a9519532c029..311fe4937f6a 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -3289,7 +3289,7 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
> >  
> >  	stat_inc_inplace_blocks(fio->sbi);
> >  
> > -	if (fio->bio)
> > +	if (fio->bio && !(SM_I(sbi)->ipu_policy & (1 << F2FS_IPU_NOCACHE)))
> >  		err = f2fs_merge_page_bio(fio);
> >  	else
> >  		err = f2fs_submit_page_bio(fio);
> > diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
> > index a1b3951367cd..02e620470eef 100644
> > --- a/fs/f2fs/segment.h
> > +++ b/fs/f2fs/segment.h
> > @@ -623,6 +623,7 @@ enum {
> >  	F2FS_IPU_SSR_UTIL,
> >  	F2FS_IPU_FSYNC,
> >  	F2FS_IPU_ASYNC,
> > +	F2FS_IPU_NOCACHE,
> >  };
> >  
> >  static inline unsigned int curseg_segno(struct f2fs_sb_info *sbi,
> > 

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

* Re: [f2fs-dev] [PATCH] f2fs: add a way to turn off ipu bio cache
  2020-01-08 12:04   ` Jaegeuk Kim
@ 2020-01-08 12:23     ` Chao Yu
  2020-01-08 23:18       ` Jaegeuk Kim
  0 siblings, 1 reply; 6+ messages in thread
From: Chao Yu @ 2020-01-08 12:23 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

On 2020/1/8 20:04, Jaegeuk Kim wrote:
> On 01/08, Chao Yu wrote:
>> On 2020/1/7 10:07, Jaegeuk Kim wrote:
>>> Setting 0x40 in /sys/fs/f2fs/dev/ipu_policy gives a way to turn off
>>> bio cache, which is useufl to check whether block layer using hardware
>>> encryption engine merges IOs correctly.
>>>
>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>> ---
>>>  Documentation/filesystems/f2fs.txt | 1 +
>>>  fs/f2fs/segment.c                  | 2 +-
>>>  fs/f2fs/segment.h                  | 1 +
>>>  3 files changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
>>> index 41b5aa94b30f..cd93bcc34726 100644
>>> --- a/Documentation/filesystems/f2fs.txt
>>> +++ b/Documentation/filesystems/f2fs.txt
>>> @@ -335,6 +335,7 @@ Files in /sys/fs/f2fs/<devname>
>>>                                 0x01: F2FS_IPU_FORCE, 0x02: F2FS_IPU_SSR,
>>>                                 0x04: F2FS_IPU_UTIL,  0x08: F2FS_IPU_SSR_UTIL,
>>>                                 0x10: F2FS_IPU_FSYNC.
>>
>> . -> ,
> 
> Actually, we can't do it. I revised it a bit instead.

One more question, why skipping 0x20 bit position?

Thanks,

> 
>>
>> Reviewed-by: Chao Yu <yuchao0@huawei.com>
>>
>> Thanks,
>>
>>> +			       0x40: F2FS_IPU_NOCACHE disables bio caches.
>>>  
>>>   min_ipu_util                 This parameter controls the threshold to trigger
>>>                                in-place-updates. The number indicates percentage
>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>> index a9519532c029..311fe4937f6a 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -3289,7 +3289,7 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
>>>  
>>>  	stat_inc_inplace_blocks(fio->sbi);
>>>  
>>> -	if (fio->bio)
>>> +	if (fio->bio && !(SM_I(sbi)->ipu_policy & (1 << F2FS_IPU_NOCACHE)))
>>>  		err = f2fs_merge_page_bio(fio);
>>>  	else
>>>  		err = f2fs_submit_page_bio(fio);
>>> diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
>>> index a1b3951367cd..02e620470eef 100644
>>> --- a/fs/f2fs/segment.h
>>> +++ b/fs/f2fs/segment.h
>>> @@ -623,6 +623,7 @@ enum {
>>>  	F2FS_IPU_SSR_UTIL,
>>>  	F2FS_IPU_FSYNC,
>>>  	F2FS_IPU_ASYNC,
>>> +	F2FS_IPU_NOCACHE,
>>>  };
>>>  
>>>  static inline unsigned int curseg_segno(struct f2fs_sb_info *sbi,
>>>
> .
> 

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

* Re: [f2fs-dev] [PATCH] f2fs: add a way to turn off ipu bio cache
  2020-01-08 12:23     ` Chao Yu
@ 2020-01-08 23:18       ` Jaegeuk Kim
  2020-01-11  9:26         ` Chao Yu
  0 siblings, 1 reply; 6+ messages in thread
From: Jaegeuk Kim @ 2020-01-08 23:18 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 01/08, Chao Yu wrote:
> On 2020/1/8 20:04, Jaegeuk Kim wrote:
> > On 01/08, Chao Yu wrote:
> >> On 2020/1/7 10:07, Jaegeuk Kim wrote:
> >>> Setting 0x40 in /sys/fs/f2fs/dev/ipu_policy gives a way to turn off
> >>> bio cache, which is useufl to check whether block layer using hardware
> >>> encryption engine merges IOs correctly.
> >>>
> >>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >>> ---
> >>>  Documentation/filesystems/f2fs.txt | 1 +
> >>>  fs/f2fs/segment.c                  | 2 +-
> >>>  fs/f2fs/segment.h                  | 1 +
> >>>  3 files changed, 3 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
> >>> index 41b5aa94b30f..cd93bcc34726 100644
> >>> --- a/Documentation/filesystems/f2fs.txt
> >>> +++ b/Documentation/filesystems/f2fs.txt
> >>> @@ -335,6 +335,7 @@ Files in /sys/fs/f2fs/<devname>
> >>>                                 0x01: F2FS_IPU_FORCE, 0x02: F2FS_IPU_SSR,
> >>>                                 0x04: F2FS_IPU_UTIL,  0x08: F2FS_IPU_SSR_UTIL,
> >>>                                 0x10: F2FS_IPU_FSYNC.
> >>
> >> . -> ,
> > 
> > Actually, we can't do it. I revised it a bit instead.
> 
> One more question, why skipping 0x20 bit position?

It seems original patch missed to add comment.

From f9447095de55a3cda1023a37a5e1cb6dd2f54ebb Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaegeuk@kernel.org>
Date: Wed, 8 Jan 2020 15:10:02 -0800
Subject: [PATCH] f2fs: update f2fs document regarding to fsync_mode

This patch adds missing fsync_mode entry in f2fs document.

Fixes: 04485987f053 ("f2fs: introduce async IPU policy")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 Documentation/filesystems/f2fs.txt | 3 ++-
 fs/f2fs/segment.h                  | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
index b80a7b69f210..ee61ace30276 100644
--- a/Documentation/filesystems/f2fs.txt
+++ b/Documentation/filesystems/f2fs.txt
@@ -334,7 +334,8 @@ Files in /sys/fs/f2fs/<devname>
                               updates in f2fs. User can set:
                                0x01: F2FS_IPU_FORCE, 0x02: F2FS_IPU_SSR,
                                0x04: F2FS_IPU_UTIL,  0x08: F2FS_IPU_SSR_UTIL,
-                               0x10: F2FS_IPU_FSYNC, 0x40: F2FS_IPU_NOCACHE.
+                               0x10: F2FS_IPU_FSYNC, 0x20: F2FS_IPU_ASYNC,
+                               0x40: F2FS_IPU_NOCACHE.
                               Refer segment.h for details.
 
  min_ipu_util                 This parameter controls the threshold to trigger
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 5e6cd8d8411d..459dc3901a57 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -607,9 +607,10 @@ static inline int utilization(struct f2fs_sb_info *sbi)
  *                     threashold,
  * F2FS_IPU_FSYNC - activated in fsync path only for high performance flash
  *                     storages. IPU will be triggered only if the # of dirty
- *                     pages over min_fsync_blocks.
+ *                     pages over min_fsync_blocks. (=default option)
+ * F2FS_IPU_ASYNC - do IPU given by asynchronous write requests.
  * F2FS_IPU_NOCACHE - disable IPU bio cache.
- * F2FS_IPUT_DISABLE - disable IPU. (=default option)
+ * F2FS_IPUT_DISABLE - disable IPU. (=default option in LFS mode)
  */
 #define DEF_MIN_IPU_UTIL	70
 #define DEF_MIN_FSYNC_BLOCKS	8
-- 
2.24.0.525.g8f36a354ae-goog


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

* Re: [f2fs-dev] [PATCH] f2fs: add a way to turn off ipu bio cache
  2020-01-08 23:18       ` Jaegeuk Kim
@ 2020-01-11  9:26         ` Chao Yu
  0 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2020-01-11  9:26 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

On 2020/1/9 7:18, Jaegeuk Kim wrote:
> On 01/08, Chao Yu wrote:
>> On 2020/1/8 20:04, Jaegeuk Kim wrote:
>>> On 01/08, Chao Yu wrote:
>>>> On 2020/1/7 10:07, Jaegeuk Kim wrote:
>>>>> Setting 0x40 in /sys/fs/f2fs/dev/ipu_policy gives a way to turn off
>>>>> bio cache, which is useufl to check whether block layer using hardware
>>>>> encryption engine merges IOs correctly.
>>>>>
>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>>>> ---
>>>>>  Documentation/filesystems/f2fs.txt | 1 +
>>>>>  fs/f2fs/segment.c                  | 2 +-
>>>>>  fs/f2fs/segment.h                  | 1 +
>>>>>  3 files changed, 3 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
>>>>> index 41b5aa94b30f..cd93bcc34726 100644
>>>>> --- a/Documentation/filesystems/f2fs.txt
>>>>> +++ b/Documentation/filesystems/f2fs.txt
>>>>> @@ -335,6 +335,7 @@ Files in /sys/fs/f2fs/<devname>
>>>>>                                 0x01: F2FS_IPU_FORCE, 0x02: F2FS_IPU_SSR,
>>>>>                                 0x04: F2FS_IPU_UTIL,  0x08: F2FS_IPU_SSR_UTIL,
>>>>>                                 0x10: F2FS_IPU_FSYNC.
>>>>
>>>> . -> ,
>>>
>>> Actually, we can't do it. I revised it a bit instead.
>>
>> One more question, why skipping 0x20 bit position?
> 
> It seems original patch missed to add comment.
> 
>>From f9447095de55a3cda1023a37a5e1cb6dd2f54ebb Mon Sep 17 00:00:00 2001
> From: Jaegeuk Kim <jaegeuk@kernel.org>
> Date: Wed, 8 Jan 2020 15:10:02 -0800
> Subject: [PATCH] f2fs: update f2fs document regarding to fsync_mode
> 
> This patch adds missing fsync_mode entry in f2fs document.
> 
> Fixes: 04485987f053 ("f2fs: introduce async IPU policy")
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

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

end of thread, other threads:[~2020-01-11  9:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07  2:07 [PATCH] f2fs: add a way to turn off ipu bio cache Jaegeuk Kim
2020-01-08  7:59 ` [f2fs-dev] " Chao Yu
2020-01-08 12:04   ` Jaegeuk Kim
2020-01-08 12:23     ` Chao Yu
2020-01-08 23:18       ` Jaegeuk Kim
2020-01-11  9:26         ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).