linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards
@ 2023-07-30 14:25 Chao Yu
  2023-07-30 14:25 ` [f2fs-dev] [PATCH 2/2] Revert "f2fs: do not issue small discard commands during checkpoint" Chao Yu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chao Yu @ 2023-07-30 14:25 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

The description of max_small_discards is out-of-update in below two
aspects, fix it.
- it is disabled by default
- small discards will be issued during checkpoint

Signed-off-by: Chao Yu <chao@kernel.org>
---
 Documentation/ABI/testing/sysfs-fs-f2fs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index ad3d76d37c8b..36c3cb547901 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -102,9 +102,9 @@ What:		/sys/fs/f2fs/<disk>/max_small_discards
 Date:		November 2013
 Contact:	"Jaegeuk Kim" <jaegeuk.kim@samsung.com>
 Description:	Controls the issue rate of discard commands that consist of small
-		blocks less than 2MB. The candidates to be discarded are cached until
-		checkpoint is triggered, and issued during the checkpoint.
-		By default, it is disabled with 0.
+		blocks less than 2MB. The candidates to be discarded are cached during
+		checkpoint, and issued by issue_discard thread after checkpoint.
+		It is enabled by default.
 
 What:		/sys/fs/f2fs/<disk>/max_ordered_discard
 Date:		October 2022
-- 
2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [PATCH 2/2] Revert "f2fs: do not issue small discard commands during checkpoint"
  2023-07-30 14:25 [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards Chao Yu
@ 2023-07-30 14:25 ` Chao Yu
  2023-08-17 15:21 ` [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards Chao Yu
  2023-08-21 19:50 ` patchwork-bot+f2fs
  2 siblings, 0 replies; 5+ messages in thread
From: Chao Yu @ 2023-07-30 14:25 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

Previously, we have two mechanisms to cache & submit small discards:

a) set max small discard number in /sys/fs/f2fs/vdb/max_small_discards,
and checkpoint will cache small discard candidates w/ configured maximum
number.

b) call FITRIM ioctl, also, checkpoint in f2fs_trim_fs() will cache small
discard candidates w/ configured discard granularity, but w/o limitation
of number. FSTRIM interface is asynchronized, so it won't submit discard
directly.

Finally, discard thread will submit them in background periodically.

However, after commit 9ac00e7cef10 ("f2fs: do not issue small discard
commands during checkpoint"), the mechanism a) is broken, since no matter
how we configure the sysfs entry /sys/fs/f2fs/vdb/max_small_discards,
checkpoint will not cache small discard candidates any more.

echo 0 > /sys/fs/f2fs/vdb/max_small_discards
xfs_io -f /mnt/f2fs/file -c "pwrite 0 2m" -c "fsync"
xfs_io /mnt/f2fs/file -c "fpunch 0 4k"
sync
cat /proc/fs/f2fs/vdb/discard_plist_info |head -2

echo 100 > /sys/fs/f2fs/vdb/max_small_discards
rm /mnt/f2fs/file
xfs_io -f /mnt/f2fs/file -c "pwrite 0 2m" -c "fsync"
xfs_io /mnt/f2fs/file -c "fpunch 0 4k"
sync
cat /proc/fs/f2fs/vdb/discard_plist_info |head -2

Before the patch:
Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
  0         .       .       .       .       .       .       .       .
Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
  0         3       1       .       .       .       .       .       .

After the patch:
Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
  0         .       .       .       .       .       .       .       .
Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
  0         .       .       .       .       .       .       .       .

This patch reverts commit 9ac00e7cef10 ("f2fs: do not issue small discard
commands during checkpoint") in order to fix this issue.

Fixes: 9ac00e7cef10 ("f2fs: do not issue small discard commands during checkpoint")
Signed-off-by: Chao Yu <chao@kernel.org>
---
 fs/f2fs/segment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 6e5d1039ca76..1f0a25011687 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2195,7 +2195,7 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
 			len = next_pos - cur_pos;
 
 			if (f2fs_sb_has_blkzoned(sbi) ||
-					!force || len < cpc->trim_minlen)
+			    (force && len < cpc->trim_minlen))
 				goto skip;
 
 			f2fs_issue_discard(sbi, entry->start_blkaddr + cur_pos,
-- 
2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards
  2023-07-30 14:25 [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards Chao Yu
  2023-07-30 14:25 ` [f2fs-dev] [PATCH 2/2] Revert "f2fs: do not issue small discard commands during checkpoint" Chao Yu
@ 2023-08-17 15:21 ` Chao Yu
  2023-08-18 21:29   ` Jaegeuk Kim
  2023-08-21 19:50 ` patchwork-bot+f2fs
  2 siblings, 1 reply; 5+ messages in thread
From: Chao Yu @ 2023-08-17 15:21 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

Ping,

On 2023/7/30 22:25, Chao Yu wrote:
> The description of max_small_discards is out-of-update in below two
> aspects, fix it.
> - it is disabled by default
> - small discards will be issued during checkpoint
> 
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>   Documentation/ABI/testing/sysfs-fs-f2fs | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> index ad3d76d37c8b..36c3cb547901 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -102,9 +102,9 @@ What:		/sys/fs/f2fs/<disk>/max_small_discards
>   Date:		November 2013
>   Contact:	"Jaegeuk Kim" <jaegeuk.kim@samsung.com>
>   Description:	Controls the issue rate of discard commands that consist of small
> -		blocks less than 2MB. The candidates to be discarded are cached until
> -		checkpoint is triggered, and issued during the checkpoint.
> -		By default, it is disabled with 0.
> +		blocks less than 2MB. The candidates to be discarded are cached during
> +		checkpoint, and issued by issue_discard thread after checkpoint.
> +		It is enabled by default.
>   
>   What:		/sys/fs/f2fs/<disk>/max_ordered_discard
>   Date:		October 2022


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards
  2023-08-17 15:21 ` [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards Chao Yu
@ 2023-08-18 21:29   ` Jaegeuk Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2023-08-18 21:29 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

Let me apply this and see what'll happen later, since no luck to reproduce.

On 08/17, Chao Yu wrote:
> Ping,
> 
> On 2023/7/30 22:25, Chao Yu wrote:
> > The description of max_small_discards is out-of-update in below two
> > aspects, fix it.
> > - it is disabled by default
> > - small discards will be issued during checkpoint
> > 
> > Signed-off-by: Chao Yu <chao@kernel.org>
> > ---
> >   Documentation/ABI/testing/sysfs-fs-f2fs | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> > index ad3d76d37c8b..36c3cb547901 100644
> > --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> > @@ -102,9 +102,9 @@ What:		/sys/fs/f2fs/<disk>/max_small_discards
> >   Date:		November 2013
> >   Contact:	"Jaegeuk Kim" <jaegeuk.kim@samsung.com>
> >   Description:	Controls the issue rate of discard commands that consist of small
> > -		blocks less than 2MB. The candidates to be discarded are cached until
> > -		checkpoint is triggered, and issued during the checkpoint.
> > -		By default, it is disabled with 0.
> > +		blocks less than 2MB. The candidates to be discarded are cached during
> > +		checkpoint, and issued by issue_discard thread after checkpoint.
> > +		It is enabled by default.
> >   What:		/sys/fs/f2fs/<disk>/max_ordered_discard
> >   Date:		October 2022


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards
  2023-07-30 14:25 [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards Chao Yu
  2023-07-30 14:25 ` [f2fs-dev] [PATCH 2/2] Revert "f2fs: do not issue small discard commands during checkpoint" Chao Yu
  2023-08-17 15:21 ` [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards Chao Yu
@ 2023-08-21 19:50 ` patchwork-bot+f2fs
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+f2fs @ 2023-08-21 19:50 UTC (permalink / raw)
  To: Chao Yu; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel

Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Sun, 30 Jul 2023 22:25:51 +0800 you wrote:
> The description of max_small_discards is out-of-update in below two
> aspects, fix it.
> - it is disabled by default
> - small discards will be issued during checkpoint
> 
> Signed-off-by: Chao Yu <chao@kernel.org>
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,1/2] f2fs: doc: fix description of max_small_discards
    https://git.kernel.org/jaegeuk/f2fs/c/726865e69aa3
  - [f2fs-dev,2/2] Revert "f2fs: do not issue small discard commands during checkpoint"
    https://git.kernel.org/jaegeuk/f2fs/c/005abf9e5e0d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2023-08-21 19:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-30 14:25 [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards Chao Yu
2023-07-30 14:25 ` [f2fs-dev] [PATCH 2/2] Revert "f2fs: do not issue small discard commands during checkpoint" Chao Yu
2023-08-17 15:21 ` [f2fs-dev] [PATCH 1/2] f2fs: doc: fix description of max_small_discards Chao Yu
2023-08-18 21:29   ` Jaegeuk Kim
2023-08-21 19:50 ` patchwork-bot+f2fs

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).