linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: skip adding a discard command if exists
@ 2023-11-14 21:24 Jaegeuk Kim
  2023-11-15  1:05 ` [f2fs-dev] " Chao Yu
  2023-11-30 18:30 ` patchwork-bot+f2fs
  0 siblings, 2 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2023-11-14 21:24 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

When recovering zoned UFS, sometimes we add the same zone to discard multiple
times. Simple workaround is to bypass adding it.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 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 727d016318f9..f4ffd64b44b2 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1380,7 +1380,8 @@ static void __insert_discard_cmd(struct f2fs_sb_info *sbi,
 			p = &(*p)->rb_right;
 			leftmost = false;
 		} else {
-			f2fs_bug_on(sbi, 1);
+			/* Let's skip to add, if exists */
+			return;
 		}
 	}
 
-- 
2.43.0.rc0.421.g78406f8d94-goog


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

* Re: [f2fs-dev] [PATCH] f2fs: skip adding a discard command if exists
  2023-11-14 21:24 [PATCH] f2fs: skip adding a discard command if exists Jaegeuk Kim
@ 2023-11-15  1:05 ` Chao Yu
  2023-11-15  2:45   ` Jaegeuk Kim
  2023-11-30 18:30 ` patchwork-bot+f2fs
  1 sibling, 1 reply; 7+ messages in thread
From: Chao Yu @ 2023-11-15  1:05 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2023/11/15 5:24, Jaegeuk Kim wrote:
> When recovering zoned UFS, sometimes we add the same zone to discard multiple
> times. Simple workaround is to bypass adding it.

What about skipping f2fs_bug_on() just for zoned UFS case? so that the check
condition can still be used for non-zoned UFS case.

Thanks,

> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>   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 727d016318f9..f4ffd64b44b2 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1380,7 +1380,8 @@ static void __insert_discard_cmd(struct f2fs_sb_info *sbi,
>   			p = &(*p)->rb_right;
>   			leftmost = false;
>   		} else {
> -			f2fs_bug_on(sbi, 1);
> +			/* Let's skip to add, if exists */
> +			return;
>   		}
>   	}
>   

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

* Re: [f2fs-dev] [PATCH] f2fs: skip adding a discard command if exists
  2023-11-15  1:05 ` [f2fs-dev] " Chao Yu
@ 2023-11-15  2:45   ` Jaegeuk Kim
  2023-11-15  6:28     ` Chao Yu
  0 siblings, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2023-11-15  2:45 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 11/15, Chao Yu wrote:
> On 2023/11/15 5:24, Jaegeuk Kim wrote:
> > When recovering zoned UFS, sometimes we add the same zone to discard multiple
> > times. Simple workaround is to bypass adding it.
> 
> What about skipping f2fs_bug_on() just for zoned UFS case? so that the check
> condition can still be used for non-zoned UFS case.

Hmm, I've never seen this bug_on before, but even this really happens, it does
not make sense to move forward to create duplicate commands resulting in a loop.

So, the question is, do we really need to check this? Have we hit this before?

> 
> Thanks,
> 
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >   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 727d016318f9..f4ffd64b44b2 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -1380,7 +1380,8 @@ static void __insert_discard_cmd(struct f2fs_sb_info *sbi,
> >   			p = &(*p)->rb_right;
> >   			leftmost = false;
> >   		} else {
> > -			f2fs_bug_on(sbi, 1);
> > +			/* Let's skip to add, if exists */
> > +			return;
> >   		}
> >   	}

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

* Re: [f2fs-dev] [PATCH] f2fs: skip adding a discard command if exists
  2023-11-15  2:45   ` Jaegeuk Kim
@ 2023-11-15  6:28     ` Chao Yu
  2023-11-17 17:41       ` Jaegeuk Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Chao Yu @ 2023-11-15  6:28 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

On 2023/11/15 10:45, Jaegeuk Kim wrote:
> On 11/15, Chao Yu wrote:
>> On 2023/11/15 5:24, Jaegeuk Kim wrote:
>>> When recovering zoned UFS, sometimes we add the same zone to discard multiple
>>> times. Simple workaround is to bypass adding it.
>>
>> What about skipping f2fs_bug_on() just for zoned UFS case? so that the check
>> condition can still be used for non-zoned UFS case.
> 
> Hmm, I've never seen this bug_on before, but even this really happens, it does

I've never seen it was been triggered as well.

> not make sense to move forward to create duplicate commands resulting in a loop.

Agreed.

It looks those codes were copied from extent_cache code base, do we need to fix
all cases to avoid loop?

> 
> So, the question is, do we really need to check this? Have we hit this before?
Not sure, just be worry about that flaw of newly developed feature can make
code run into that branch.

Thanks,

> 
>>
>> Thanks,
>>
>>>
>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>> ---
>>>    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 727d016318f9..f4ffd64b44b2 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -1380,7 +1380,8 @@ static void __insert_discard_cmd(struct f2fs_sb_info *sbi,
>>>    			p = &(*p)->rb_right;
>>>    			leftmost = false;
>>>    		} else {
>>> -			f2fs_bug_on(sbi, 1);
>>> +			/* Let's skip to add, if exists */
>>> +			return;
>>>    		}
>>>    	}

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

* Re: [f2fs-dev] [PATCH] f2fs: skip adding a discard command if exists
  2023-11-15  6:28     ` Chao Yu
@ 2023-11-17 17:41       ` Jaegeuk Kim
  2023-11-20  3:19         ` Chao Yu
  0 siblings, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2023-11-17 17:41 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 11/15, Chao Yu wrote:
> On 2023/11/15 10:45, Jaegeuk Kim wrote:
> > On 11/15, Chao Yu wrote:
> > > On 2023/11/15 5:24, Jaegeuk Kim wrote:
> > > > When recovering zoned UFS, sometimes we add the same zone to discard multiple
> > > > times. Simple workaround is to bypass adding it.
> > > 
> > > What about skipping f2fs_bug_on() just for zoned UFS case? so that the check
> > > condition can still be used for non-zoned UFS case.
> > 
> > Hmm, I've never seen this bug_on before, but even this really happens, it does
> 
> I've never seen it was been triggered as well.
> 
> > not make sense to move forward to create duplicate commands resulting in a loop.
> 
> Agreed.
> 
> It looks those codes were copied from extent_cache code base, do we need to fix
> all cases to avoid loop?

Not sure other cases yet.. let's do one by one, since I hit this in real.

> 
> > 
> > So, the question is, do we really need to check this? Have we hit this before?
> Not sure, just be worry about that flaw of newly developed feature can make
> code run into that branch.
> 
> Thanks,
> 
> > 
> > > 
> > > Thanks,
> > > 
> > > > 
> > > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > > > ---
> > > >    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 727d016318f9..f4ffd64b44b2 100644
> > > > --- a/fs/f2fs/segment.c
> > > > +++ b/fs/f2fs/segment.c
> > > > @@ -1380,7 +1380,8 @@ static void __insert_discard_cmd(struct f2fs_sb_info *sbi,
> > > >    			p = &(*p)->rb_right;
> > > >    			leftmost = false;
> > > >    		} else {
> > > > -			f2fs_bug_on(sbi, 1);
> > > > +			/* Let's skip to add, if exists */
> > > > +			return;
> > > >    		}
> > > >    	}

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

* Re: [f2fs-dev] [PATCH] f2fs: skip adding a discard command if exists
  2023-11-17 17:41       ` Jaegeuk Kim
@ 2023-11-20  3:19         ` Chao Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2023-11-20  3:19 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

On 2023/11/18 1:41, Jaegeuk Kim wrote:
> Not sure other cases yet.. let's do one by one, since I hit this in real.

Sure.

>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

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

Thansk,

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

* Re: [f2fs-dev] [PATCH] f2fs: skip adding a discard command if exists
  2023-11-14 21:24 [PATCH] f2fs: skip adding a discard command if exists Jaegeuk Kim
  2023-11-15  1:05 ` [f2fs-dev] " Chao Yu
@ 2023-11-30 18:30 ` patchwork-bot+f2fs
  1 sibling, 0 replies; 7+ messages in thread
From: patchwork-bot+f2fs @ 2023-11-30 18:30 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

Hello:

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

On Tue, 14 Nov 2023 13:24:14 -0800 you wrote:
> When recovering zoned UFS, sometimes we add the same zone to discard multiple
> times. Simple workaround is to bypass adding it.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/segment.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
  - [f2fs-dev] f2fs: skip adding a discard command if exists
    https://git.kernel.org/jaegeuk/f2fs/c/bbd3efed3383

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

end of thread, other threads:[~2023-11-30 18:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-14 21:24 [PATCH] f2fs: skip adding a discard command if exists Jaegeuk Kim
2023-11-15  1:05 ` [f2fs-dev] " Chao Yu
2023-11-15  2:45   ` Jaegeuk Kim
2023-11-15  6:28     ` Chao Yu
2023-11-17 17:41       ` Jaegeuk Kim
2023-11-20  3:19         ` Chao Yu
2023-11-30 18:30 ` 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).