All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
       [not found] <CGME20230313094825epcms2p71e6cb549251dc55e8d202dd64b9913a6@epcms2p7>
@ 2023-03-13  9:48   ` Yonggil Song
  0 siblings, 0 replies; 16+ messages in thread
From: Yonggil Song @ 2023-03-13  9:48 UTC (permalink / raw)
  To: jaegeuk, chao, linux-f2fs-devel, linux-kernel

When using f2fs on a zoned block device with 2MiB zone size, IO errors
occurs because f2fs tries to write data to a zone that has not been reset.

The cause is that f2fs tries to discard multiple zones at once. This is
caused by a condition in f2fs_clear_prefree_segments that does not check
for zoned block devices when setting the discard range. This leads to
invalid reset commands and write pointer mismatches.

This patch fixes the zoned block device with 2MiB zone size to reset one
zone at a time.

Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
---
 fs/f2fs/segment.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index acf3d3fa4363..2b6cb6df623b 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
 					(end - 1) <= cpc->trim_end)
 				continue;
 
-		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
+		if (!f2fs_sb_has_blkzoned(sbi) &&
+		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
 			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
 				(end - start) << sbi->log_blocks_per_seg);
 			continue;
-- 
2.34.1


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

* [f2fs-dev] [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
@ 2023-03-13  9:48   ` Yonggil Song
  0 siblings, 0 replies; 16+ messages in thread
From: Yonggil Song @ 2023-03-13  9:48 UTC (permalink / raw)
  To: jaegeuk, chao, linux-f2fs-devel, linux-kernel

When using f2fs on a zoned block device with 2MiB zone size, IO errors
occurs because f2fs tries to write data to a zone that has not been reset.

The cause is that f2fs tries to discard multiple zones at once. This is
caused by a condition in f2fs_clear_prefree_segments that does not check
for zoned block devices when setting the discard range. This leads to
invalid reset commands and write pointer mismatches.

This patch fixes the zoned block device with 2MiB zone size to reset one
zone at a time.

Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
---
 fs/f2fs/segment.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index acf3d3fa4363..2b6cb6df623b 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
 					(end - 1) <= cpc->trim_end)
 				continue;
 
-		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
+		if (!f2fs_sb_has_blkzoned(sbi) &&
+		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
 			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
 				(end - start) << sbi->log_blocks_per_seg);
 			continue;
-- 
2.34.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] 16+ messages in thread

* Re: [f2fs-dev] [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
  2023-03-13  9:48   ` [f2fs-dev] " Yonggil Song
@ 2023-03-21 16:40     ` patchwork-bot+f2fs
  -1 siblings, 0 replies; 16+ messages in thread
From: patchwork-bot+f2fs @ 2023-03-21 16:40 UTC (permalink / raw)
  To: Yonggil Song; +Cc: jaegeuk, chao, linux-f2fs-devel, linux-kernel

Hello:

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

On Mon, 13 Mar 2023 18:48:25 +0900 you wrote:
> When using f2fs on a zoned block device with 2MiB zone size, IO errors
> occurs because f2fs tries to write data to a zone that has not been reset.
> 
> The cause is that f2fs tries to discard multiple zones at once. This is
> caused by a condition in f2fs_clear_prefree_segments that does not check
> for zoned block devices when setting the discard range. This leads to
> invalid reset commands and write pointer mismatches.
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
    https://git.kernel.org/jaegeuk/f2fs/c/5108a09b11d7

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



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

* Re: [f2fs-dev] [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
@ 2023-03-21 16:40     ` patchwork-bot+f2fs
  0 siblings, 0 replies; 16+ messages in thread
From: patchwork-bot+f2fs @ 2023-03-21 16:40 UTC (permalink / raw)
  To: Yonggil Song; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel

Hello:

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

On Mon, 13 Mar 2023 18:48:25 +0900 you wrote:
> When using f2fs on a zoned block device with 2MiB zone size, IO errors
> occurs because f2fs tries to write data to a zone that has not been reset.
> 
> The cause is that f2fs tries to discard multiple zones at once. This is
> caused by a condition in f2fs_clear_prefree_segments that does not check
> for zoned block devices when setting the discard range. This leads to
> invalid reset commands and write pointer mismatches.
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
    https://git.kernel.org/jaegeuk/f2fs/c/5108a09b11d7

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] 16+ messages in thread

* Re: [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
  2023-03-13  9:48   ` [f2fs-dev] " Yonggil Song
@ 2023-03-23 15:17     ` Chao Yu
  -1 siblings, 0 replies; 16+ messages in thread
From: Chao Yu @ 2023-03-23 15:17 UTC (permalink / raw)
  To: yonggil.song, jaegeuk, linux-f2fs-devel, linux-kernel

On 2023/3/13 17:48, Yonggil Song wrote:
> When using f2fs on a zoned block device with 2MiB zone size, IO errors
> occurs because f2fs tries to write data to a zone that has not been reset.
> 
> The cause is that f2fs tries to discard multiple zones at once. This is
> caused by a condition in f2fs_clear_prefree_segments that does not check
> for zoned block devices when setting the discard range. This leads to
> invalid reset commands and write pointer mismatches.
> 
> This patch fixes the zoned block device with 2MiB zone size to reset one
> zone at a time.
> 
> Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
> ---
>   fs/f2fs/segment.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index acf3d3fa4363..2b6cb6df623b 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
>   					(end - 1) <= cpc->trim_end)
>   				continue;
>   
> -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
> +		if (!f2fs_sb_has_blkzoned(sbi) &&

Could you please add one line comment here for this change?

Otherwise it looks good to me.

Thanks,

> +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
>   			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
>   				(end - start) << sbi->log_blocks_per_seg);
>   			continue;

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

* Re: [f2fs-dev] [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
@ 2023-03-23 15:17     ` Chao Yu
  0 siblings, 0 replies; 16+ messages in thread
From: Chao Yu @ 2023-03-23 15:17 UTC (permalink / raw)
  To: yonggil.song, jaegeuk, linux-f2fs-devel, linux-kernel

On 2023/3/13 17:48, Yonggil Song wrote:
> When using f2fs on a zoned block device with 2MiB zone size, IO errors
> occurs because f2fs tries to write data to a zone that has not been reset.
> 
> The cause is that f2fs tries to discard multiple zones at once. This is
> caused by a condition in f2fs_clear_prefree_segments that does not check
> for zoned block devices when setting the discard range. This leads to
> invalid reset commands and write pointer mismatches.
> 
> This patch fixes the zoned block device with 2MiB zone size to reset one
> zone at a time.
> 
> Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
> ---
>   fs/f2fs/segment.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index acf3d3fa4363..2b6cb6df623b 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
>   					(end - 1) <= cpc->trim_end)
>   				continue;
>   
> -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
> +		if (!f2fs_sb_has_blkzoned(sbi) &&

Could you please add one line comment here for this change?

Otherwise it looks good to me.

Thanks,

> +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
>   			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
>   				(end - start) << sbi->log_blocks_per_seg);
>   			continue;


_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
  2023-03-23 15:17     ` [f2fs-dev] " Chao Yu
@ 2023-03-23 22:03       ` Jaegeuk Kim
  -1 siblings, 0 replies; 16+ messages in thread
From: Jaegeuk Kim @ 2023-03-23 22:03 UTC (permalink / raw)
  To: Chao Yu; +Cc: yonggil.song, linux-f2fs-devel, linux-kernel

On 03/23, Chao Yu wrote:
> On 2023/3/13 17:48, Yonggil Song wrote:
> > When using f2fs on a zoned block device with 2MiB zone size, IO errors
> > occurs because f2fs tries to write data to a zone that has not been reset.
> > 
> > The cause is that f2fs tries to discard multiple zones at once. This is
> > caused by a condition in f2fs_clear_prefree_segments that does not check
> > for zoned block devices when setting the discard range. This leads to
> > invalid reset commands and write pointer mismatches.
> > 
> > This patch fixes the zoned block device with 2MiB zone size to reset one
> > zone at a time.
> > 
> > Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
> > ---
> >   fs/f2fs/segment.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index acf3d3fa4363..2b6cb6df623b 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
> >   					(end - 1) <= cpc->trim_end)
> >   				continue;
> > -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
> > +		if (!f2fs_sb_has_blkzoned(sbi) &&
> 
> Could you please add one line comment here for this change?

This was merged in -dev a while ago. I don't think this would be critical
to rebase it again.

> 
> Otherwise it looks good to me.
> 
> Thanks,
> 
> > +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
> >   			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
> >   				(end - start) << sbi->log_blocks_per_seg);
> >   			continue;

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

* Re: [f2fs-dev] [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
@ 2023-03-23 22:03       ` Jaegeuk Kim
  0 siblings, 0 replies; 16+ messages in thread
From: Jaegeuk Kim @ 2023-03-23 22:03 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 03/23, Chao Yu wrote:
> On 2023/3/13 17:48, Yonggil Song wrote:
> > When using f2fs on a zoned block device with 2MiB zone size, IO errors
> > occurs because f2fs tries to write data to a zone that has not been reset.
> > 
> > The cause is that f2fs tries to discard multiple zones at once. This is
> > caused by a condition in f2fs_clear_prefree_segments that does not check
> > for zoned block devices when setting the discard range. This leads to
> > invalid reset commands and write pointer mismatches.
> > 
> > This patch fixes the zoned block device with 2MiB zone size to reset one
> > zone at a time.
> > 
> > Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
> > ---
> >   fs/f2fs/segment.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index acf3d3fa4363..2b6cb6df623b 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
> >   					(end - 1) <= cpc->trim_end)
> >   				continue;
> > -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
> > +		if (!f2fs_sb_has_blkzoned(sbi) &&
> 
> Could you please add one line comment here for this change?

This was merged in -dev a while ago. I don't think this would be critical
to rebase it again.

> 
> Otherwise it looks good to me.
> 
> Thanks,
> 
> > +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
> >   			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
> >   				(end - start) << sbi->log_blocks_per_seg);
> >   			continue;


_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
  2023-03-23 22:03       ` [f2fs-dev] " Jaegeuk Kim
@ 2023-03-24  1:52         ` Chao Yu
  -1 siblings, 0 replies; 16+ messages in thread
From: Chao Yu @ 2023-03-24  1:52 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: yonggil.song, linux-f2fs-devel, linux-kernel

On 2023/3/24 6:03, Jaegeuk Kim wrote:
> On 03/23, Chao Yu wrote:
>> On 2023/3/13 17:48, Yonggil Song wrote:
>>> When using f2fs on a zoned block device with 2MiB zone size, IO errors
>>> occurs because f2fs tries to write data to a zone that has not been reset.
>>>
>>> The cause is that f2fs tries to discard multiple zones at once. This is
>>> caused by a condition in f2fs_clear_prefree_segments that does not check
>>> for zoned block devices when setting the discard range. This leads to
>>> invalid reset commands and write pointer mismatches.
>>>
>>> This patch fixes the zoned block device with 2MiB zone size to reset one
>>> zone at a time.
>>>
>>> Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
>>> ---
>>>    fs/f2fs/segment.c | 3 ++-
>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>> index acf3d3fa4363..2b6cb6df623b 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
>>>    					(end - 1) <= cpc->trim_end)
>>>    				continue;
>>> -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
>>> +		if (!f2fs_sb_has_blkzoned(sbi) &&
>>
>> Could you please add one line comment here for this change?
> 
> This was merged in -dev a while ago. I don't think this would be critical
> to rebase it again.

Yes, it's not critical, fine to me.

Thanks,

> 
>>
>> Otherwise it looks good to me.
>>
>> Thanks,
>>
>>> +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
>>>    			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
>>>    				(end - start) << sbi->log_blocks_per_seg);
>>>    			continue;

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

* Re: [f2fs-dev] [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
@ 2023-03-24  1:52         ` Chao Yu
  0 siblings, 0 replies; 16+ messages in thread
From: Chao Yu @ 2023-03-24  1:52 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

On 2023/3/24 6:03, Jaegeuk Kim wrote:
> On 03/23, Chao Yu wrote:
>> On 2023/3/13 17:48, Yonggil Song wrote:
>>> When using f2fs on a zoned block device with 2MiB zone size, IO errors
>>> occurs because f2fs tries to write data to a zone that has not been reset.
>>>
>>> The cause is that f2fs tries to discard multiple zones at once. This is
>>> caused by a condition in f2fs_clear_prefree_segments that does not check
>>> for zoned block devices when setting the discard range. This leads to
>>> invalid reset commands and write pointer mismatches.
>>>
>>> This patch fixes the zoned block device with 2MiB zone size to reset one
>>> zone at a time.
>>>
>>> Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
>>> ---
>>>    fs/f2fs/segment.c | 3 ++-
>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>> index acf3d3fa4363..2b6cb6df623b 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
>>>    					(end - 1) <= cpc->trim_end)
>>>    				continue;
>>> -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
>>> +		if (!f2fs_sb_has_blkzoned(sbi) &&
>>
>> Could you please add one line comment here for this change?
> 
> This was merged in -dev a while ago. I don't think this would be critical
> to rebase it again.

Yes, it's not critical, fine to me.

Thanks,

> 
>>
>> Otherwise it looks good to me.
>>
>> Thanks,
>>
>>> +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
>>>    			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
>>>    				(end - start) << sbi->log_blocks_per_seg);
>>>    			continue;


_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
  2023-03-24  1:52         ` [f2fs-dev] " Chao Yu
@ 2023-03-24 16:54           ` Jaegeuk Kim
  -1 siblings, 0 replies; 16+ messages in thread
From: Jaegeuk Kim @ 2023-03-24 16:54 UTC (permalink / raw)
  To: Chao Yu; +Cc: yonggil.song, linux-f2fs-devel, linux-kernel

On 03/24, Chao Yu wrote:
> On 2023/3/24 6:03, Jaegeuk Kim wrote:
> > On 03/23, Chao Yu wrote:
> > > On 2023/3/13 17:48, Yonggil Song wrote:
> > > > When using f2fs on a zoned block device with 2MiB zone size, IO errors
> > > > occurs because f2fs tries to write data to a zone that has not been reset.
> > > > 
> > > > The cause is that f2fs tries to discard multiple zones at once. This is
> > > > caused by a condition in f2fs_clear_prefree_segments that does not check
> > > > for zoned block devices when setting the discard range. This leads to
> > > > invalid reset commands and write pointer mismatches.
> > > > 
> > > > This patch fixes the zoned block device with 2MiB zone size to reset one
> > > > zone at a time.
> > > > 
> > > > Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
> > > > ---
> > > >    fs/f2fs/segment.c | 3 ++-
> > > >    1 file changed, 2 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > > > index acf3d3fa4363..2b6cb6df623b 100644
> > > > --- a/fs/f2fs/segment.c
> > > > +++ b/fs/f2fs/segment.c
> > > > @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
> > > >    					(end - 1) <= cpc->trim_end)
> > > >    				continue;
> > > > -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
> > > > +		if (!f2fs_sb_has_blkzoned(sbi) &&
> > > 
> > > Could you please add one line comment here for this change?
> > 
> > This was merged in -dev a while ago. I don't think this would be critical
> > to rebase it again.
> 
> Yes, it's not critical, fine to me.

Added:

/* Should cover 2MB zoned device for zone-based reset */

So lucky since I had to rebase to fix other patch. :(

"f2fs: factor out discard_cmd usage from general rb_tree use"


> 
> Thanks,
> 
> > 
> > > 
> > > Otherwise it looks good to me.
> > > 
> > > Thanks,
> > > 
> > > > +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
> > > >    			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
> > > >    				(end - start) << sbi->log_blocks_per_seg);
> > > >    			continue;

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

* Re: [f2fs-dev] [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
@ 2023-03-24 16:54           ` Jaegeuk Kim
  0 siblings, 0 replies; 16+ messages in thread
From: Jaegeuk Kim @ 2023-03-24 16:54 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 03/24, Chao Yu wrote:
> On 2023/3/24 6:03, Jaegeuk Kim wrote:
> > On 03/23, Chao Yu wrote:
> > > On 2023/3/13 17:48, Yonggil Song wrote:
> > > > When using f2fs on a zoned block device with 2MiB zone size, IO errors
> > > > occurs because f2fs tries to write data to a zone that has not been reset.
> > > > 
> > > > The cause is that f2fs tries to discard multiple zones at once. This is
> > > > caused by a condition in f2fs_clear_prefree_segments that does not check
> > > > for zoned block devices when setting the discard range. This leads to
> > > > invalid reset commands and write pointer mismatches.
> > > > 
> > > > This patch fixes the zoned block device with 2MiB zone size to reset one
> > > > zone at a time.
> > > > 
> > > > Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
> > > > ---
> > > >    fs/f2fs/segment.c | 3 ++-
> > > >    1 file changed, 2 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > > > index acf3d3fa4363..2b6cb6df623b 100644
> > > > --- a/fs/f2fs/segment.c
> > > > +++ b/fs/f2fs/segment.c
> > > > @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
> > > >    					(end - 1) <= cpc->trim_end)
> > > >    				continue;
> > > > -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
> > > > +		if (!f2fs_sb_has_blkzoned(sbi) &&
> > > 
> > > Could you please add one line comment here for this change?
> > 
> > This was merged in -dev a while ago. I don't think this would be critical
> > to rebase it again.
> 
> Yes, it's not critical, fine to me.

Added:

/* Should cover 2MB zoned device for zone-based reset */

So lucky since I had to rebase to fix other patch. :(

"f2fs: factor out discard_cmd usage from general rb_tree use"


> 
> Thanks,
> 
> > 
> > > 
> > > Otherwise it looks good to me.
> > > 
> > > Thanks,
> > > 
> > > > +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
> > > >    			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
> > > >    				(end - start) << sbi->log_blocks_per_seg);
> > > >    			continue;


_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
  2023-03-24 16:54           ` [f2fs-dev] " Jaegeuk Kim
@ 2023-03-25  7:25             ` Chao Yu
  -1 siblings, 0 replies; 16+ messages in thread
From: Chao Yu @ 2023-03-25  7:25 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: yonggil.song, linux-f2fs-devel, linux-kernel

On 2023/3/25 0:54, Jaegeuk Kim wrote:
> On 03/24, Chao Yu wrote:
>> On 2023/3/24 6:03, Jaegeuk Kim wrote:
>>> On 03/23, Chao Yu wrote:
>>>> On 2023/3/13 17:48, Yonggil Song wrote:
>>>>> When using f2fs on a zoned block device with 2MiB zone size, IO errors
>>>>> occurs because f2fs tries to write data to a zone that has not been reset.
>>>>>
>>>>> The cause is that f2fs tries to discard multiple zones at once. This is
>>>>> caused by a condition in f2fs_clear_prefree_segments that does not check
>>>>> for zoned block devices when setting the discard range. This leads to
>>>>> invalid reset commands and write pointer mismatches.
>>>>>
>>>>> This patch fixes the zoned block device with 2MiB zone size to reset one
>>>>> zone at a time.
>>>>>
>>>>> Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
>>>>> ---
>>>>>     fs/f2fs/segment.c | 3 ++-
>>>>>     1 file changed, 2 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>>>> index acf3d3fa4363..2b6cb6df623b 100644
>>>>> --- a/fs/f2fs/segment.c
>>>>> +++ b/fs/f2fs/segment.c
>>>>> @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
>>>>>     					(end - 1) <= cpc->trim_end)
>>>>>     				continue;
>>>>> -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
>>>>> +		if (!f2fs_sb_has_blkzoned(sbi) &&
>>>>
>>>> Could you please add one line comment here for this change?
>>>
>>> This was merged in -dev a while ago. I don't think this would be critical
>>> to rebase it again.
>>
>> Yes, it's not critical, fine to me.
> 
> Added:
> 
> /* Should cover 2MB zoned device for zone-based reset */

Thanks a lot for the change. :)

Thanks,

> 
> So lucky since I had to rebase to fix other patch. :(
> 
> "f2fs: factor out discard_cmd usage from general rb_tree use"
> 
> 
>>
>> Thanks,
>>
>>>
>>>>
>>>> Otherwise it looks good to me.
>>>>
>>>> Thanks,
>>>>
>>>>> +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
>>>>>     			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
>>>>>     				(end - start) << sbi->log_blocks_per_seg);
>>>>>     			continue;

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

* Re: [f2fs-dev] [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
@ 2023-03-25  7:25             ` Chao Yu
  0 siblings, 0 replies; 16+ messages in thread
From: Chao Yu @ 2023-03-25  7:25 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

On 2023/3/25 0:54, Jaegeuk Kim wrote:
> On 03/24, Chao Yu wrote:
>> On 2023/3/24 6:03, Jaegeuk Kim wrote:
>>> On 03/23, Chao Yu wrote:
>>>> On 2023/3/13 17:48, Yonggil Song wrote:
>>>>> When using f2fs on a zoned block device with 2MiB zone size, IO errors
>>>>> occurs because f2fs tries to write data to a zone that has not been reset.
>>>>>
>>>>> The cause is that f2fs tries to discard multiple zones at once. This is
>>>>> caused by a condition in f2fs_clear_prefree_segments that does not check
>>>>> for zoned block devices when setting the discard range. This leads to
>>>>> invalid reset commands and write pointer mismatches.
>>>>>
>>>>> This patch fixes the zoned block device with 2MiB zone size to reset one
>>>>> zone at a time.
>>>>>
>>>>> Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
>>>>> ---
>>>>>     fs/f2fs/segment.c | 3 ++-
>>>>>     1 file changed, 2 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>>>> index acf3d3fa4363..2b6cb6df623b 100644
>>>>> --- a/fs/f2fs/segment.c
>>>>> +++ b/fs/f2fs/segment.c
>>>>> @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
>>>>>     					(end - 1) <= cpc->trim_end)
>>>>>     				continue;
>>>>> -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
>>>>> +		if (!f2fs_sb_has_blkzoned(sbi) &&
>>>>
>>>> Could you please add one line comment here for this change?
>>>
>>> This was merged in -dev a while ago. I don't think this would be critical
>>> to rebase it again.
>>
>> Yes, it's not critical, fine to me.
> 
> Added:
> 
> /* Should cover 2MB zoned device for zone-based reset */

Thanks a lot for the change. :)

Thanks,

> 
> So lucky since I had to rebase to fix other patch. :(
> 
> "f2fs: factor out discard_cmd usage from general rb_tree use"
> 
> 
>>
>> Thanks,
>>
>>>
>>>>
>>>> Otherwise it looks good to me.
>>>>
>>>> Thanks,
>>>>
>>>>> +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
>>>>>     			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
>>>>>     				(end - start) << sbi->log_blocks_per_seg);
>>>>>     			continue;


_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
  2023-03-24 16:54           ` [f2fs-dev] " Jaegeuk Kim
@ 2023-03-26  3:49             ` Chao Yu
  -1 siblings, 0 replies; 16+ messages in thread
From: Chao Yu @ 2023-03-26  3:49 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: yonggil.song, linux-f2fs-devel, linux-kernel

On 2023/3/25 0:54, Jaegeuk Kim wrote:
> On 03/24, Chao Yu wrote:
>> On 2023/3/24 6:03, Jaegeuk Kim wrote:
>>> On 03/23, Chao Yu wrote:
>>>> On 2023/3/13 17:48, Yonggil Song wrote:
>>>>> When using f2fs on a zoned block device with 2MiB zone size, IO errors
>>>>> occurs because f2fs tries to write data to a zone that has not been reset.
>>>>>
>>>>> The cause is that f2fs tries to discard multiple zones at once. This is
>>>>> caused by a condition in f2fs_clear_prefree_segments that does not check
>>>>> for zoned block devices when setting the discard range. This leads to
>>>>> invalid reset commands and write pointer mismatches.
>>>>>
>>>>> This patch fixes the zoned block device with 2MiB zone size to reset one
>>>>> zone at a time.
>>>>>
>>>>> Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
>>>>> ---
>>>>>     fs/f2fs/segment.c | 3 ++-
>>>>>     1 file changed, 2 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>>>> index acf3d3fa4363..2b6cb6df623b 100644
>>>>> --- a/fs/f2fs/segment.c
>>>>> +++ b/fs/f2fs/segment.c
>>>>> @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
>>>>>     					(end - 1) <= cpc->trim_end)
>>>>>     				continue;
>>>>> -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
>>>>> +		if (!f2fs_sb_has_blkzoned(sbi) &&
>>>>
>>>> Could you please add one line comment here for this change?
>>>
>>> This was merged in -dev a while ago. I don't think this would be critical
>>> to rebase it again.
>>
>> Yes, it's not critical, fine to me.
> 
> Added:
> 
> /* Should cover 2MB zoned device for zone-based reset */

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

Thanks,

> 
> So lucky since I had to rebase to fix other patch. :(
> 
> "f2fs: factor out discard_cmd usage from general rb_tree use"
> 
> 
>>
>> Thanks,
>>
>>>
>>>>
>>>> Otherwise it looks good to me.
>>>>
>>>> Thanks,
>>>>
>>>>> +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
>>>>>     			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
>>>>>     				(end - start) << sbi->log_blocks_per_seg);
>>>>>     			continue;

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

* Re: [f2fs-dev] [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size
@ 2023-03-26  3:49             ` Chao Yu
  0 siblings, 0 replies; 16+ messages in thread
From: Chao Yu @ 2023-03-26  3:49 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

On 2023/3/25 0:54, Jaegeuk Kim wrote:
> On 03/24, Chao Yu wrote:
>> On 2023/3/24 6:03, Jaegeuk Kim wrote:
>>> On 03/23, Chao Yu wrote:
>>>> On 2023/3/13 17:48, Yonggil Song wrote:
>>>>> When using f2fs on a zoned block device with 2MiB zone size, IO errors
>>>>> occurs because f2fs tries to write data to a zone that has not been reset.
>>>>>
>>>>> The cause is that f2fs tries to discard multiple zones at once. This is
>>>>> caused by a condition in f2fs_clear_prefree_segments that does not check
>>>>> for zoned block devices when setting the discard range. This leads to
>>>>> invalid reset commands and write pointer mismatches.
>>>>>
>>>>> This patch fixes the zoned block device with 2MiB zone size to reset one
>>>>> zone at a time.
>>>>>
>>>>> Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
>>>>> ---
>>>>>     fs/f2fs/segment.c | 3 ++-
>>>>>     1 file changed, 2 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>>>> index acf3d3fa4363..2b6cb6df623b 100644
>>>>> --- a/fs/f2fs/segment.c
>>>>> +++ b/fs/f2fs/segment.c
>>>>> @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
>>>>>     					(end - 1) <= cpc->trim_end)
>>>>>     				continue;
>>>>> -		if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
>>>>> +		if (!f2fs_sb_has_blkzoned(sbi) &&
>>>>
>>>> Could you please add one line comment here for this change?
>>>
>>> This was merged in -dev a while ago. I don't think this would be critical
>>> to rebase it again.
>>
>> Yes, it's not critical, fine to me.
> 
> Added:
> 
> /* Should cover 2MB zoned device for zone-based reset */

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

Thanks,

> 
> So lucky since I had to rebase to fix other patch. :(
> 
> "f2fs: factor out discard_cmd usage from general rb_tree use"
> 
> 
>>
>> Thanks,
>>
>>>
>>>>
>>>> Otherwise it looks good to me.
>>>>
>>>> Thanks,
>>>>
>>>>> +		    (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
>>>>>     			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
>>>>>     				(end - start) << sbi->log_blocks_per_seg);
>>>>>     			continue;


_______________________________________________
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] 16+ messages in thread

end of thread, other threads:[~2023-03-26  3:49 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20230313094825epcms2p71e6cb549251dc55e8d202dd64b9913a6@epcms2p7>
2023-03-13  9:48 ` [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size Yonggil Song
2023-03-13  9:48   ` [f2fs-dev] " Yonggil Song
2023-03-21 16:40   ` patchwork-bot+f2fs
2023-03-21 16:40     ` patchwork-bot+f2fs
2023-03-23 15:17   ` Chao Yu
2023-03-23 15:17     ` [f2fs-dev] " Chao Yu
2023-03-23 22:03     ` Jaegeuk Kim
2023-03-23 22:03       ` [f2fs-dev] " Jaegeuk Kim
2023-03-24  1:52       ` Chao Yu
2023-03-24  1:52         ` [f2fs-dev] " Chao Yu
2023-03-24 16:54         ` Jaegeuk Kim
2023-03-24 16:54           ` [f2fs-dev] " Jaegeuk Kim
2023-03-25  7:25           ` Chao Yu
2023-03-25  7:25             ` [f2fs-dev] " Chao Yu
2023-03-26  3:49           ` Chao Yu
2023-03-26  3:49             ` [f2fs-dev] " Chao Yu

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.