* [PATCH] f2fs: fix wrong continue condition in GC
@ 2022-08-13 14:37 Jaegeuk Kim
2022-08-15 3:52 ` [f2fs-dev] " Chao Yu
2022-08-19 23:34 ` [PATCH v2] " Jaegeuk Kim
0 siblings, 2 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2022-08-13 14:37 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim, stable
We should decrease the frozen counter.
Cc: stable@kernel.org
Fixes: 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/gc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 6da21d405ce1..7e4b41240d59 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -102,7 +102,7 @@ static int gc_thread_func(void *data)
sbi->gc_urgent_high_limited = false;
spin_unlock(&sbi->gc_urgent_high_lock);
sbi->gc_mode = GC_NORMAL;
- continue;
+ goto next;
}
sbi->gc_urgent_high_remaining--;
}
--
2.37.1.595.g718a3a8f04-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: fix wrong continue condition in GC
2022-08-13 14:37 [PATCH] f2fs: fix wrong continue condition in GC Jaegeuk Kim
@ 2022-08-15 3:52 ` Chao Yu
2022-08-19 23:33 ` Jaegeuk Kim
2022-08-19 23:34 ` [PATCH v2] " Jaegeuk Kim
1 sibling, 1 reply; 5+ messages in thread
From: Chao Yu @ 2022-08-15 3:52 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel; +Cc: stable
On 2022/8/13 22:37, Jaegeuk Kim wrote:
> We should decrease the frozen counter.
>
> Cc: stable@kernel.org
> Fixes: 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node")
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> fs/f2fs/gc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 6da21d405ce1..7e4b41240d59 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -102,7 +102,7 @@ static int gc_thread_func(void *data)
> sbi->gc_urgent_high_limited = false;
> spin_unlock(&sbi->gc_urgent_high_lock);
> sbi->gc_mode = GC_NORMAL;
> - continue;
> + goto next;
> }
> sbi->gc_urgent_high_remaining--;
> }
Why not:
if (!sbi->gc_urgent_high_remaining) {
sbi->gc_urgent_high_limited = false;
spin_unlock(&sbi->gc_urgent_high_lock);
sbi->gc_mode = GC_NORMAL;
} else {
sbi->gc_urgent_high_remaining--;
}
Thanks,
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: fix wrong continue condition in GC
2022-08-15 3:52 ` [f2fs-dev] " Chao Yu
@ 2022-08-19 23:33 ` Jaegeuk Kim
0 siblings, 0 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2022-08-19 23:33 UTC (permalink / raw)
To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel, stable
On 08/15, Chao Yu wrote:
> On 2022/8/13 22:37, Jaegeuk Kim wrote:
> > We should decrease the frozen counter.
> >
> > Cc: stable@kernel.org
> > Fixes: 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node")
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> > fs/f2fs/gc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> > index 6da21d405ce1..7e4b41240d59 100644
> > --- a/fs/f2fs/gc.c
> > +++ b/fs/f2fs/gc.c
> > @@ -102,7 +102,7 @@ static int gc_thread_func(void *data)
> > sbi->gc_urgent_high_limited = false;
> > spin_unlock(&sbi->gc_urgent_high_lock);
> > sbi->gc_mode = GC_NORMAL;
> > - continue;
> > + goto next;
> > }
> > sbi->gc_urgent_high_remaining--;
> > }
>
> Why not:
>
> if (!sbi->gc_urgent_high_remaining) {
> sbi->gc_urgent_high_limited = false;
> spin_unlock(&sbi->gc_urgent_high_lock);
Should not call spin_unlock, if so. Anyway, let me send v2.
> sbi->gc_mode = GC_NORMAL;
> } else {
> sbi->gc_urgent_high_remaining--;
> }
>
> Thanks,
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] f2fs: fix wrong continue condition in GC
2022-08-13 14:37 [PATCH] f2fs: fix wrong continue condition in GC Jaegeuk Kim
2022-08-15 3:52 ` [f2fs-dev] " Chao Yu
@ 2022-08-19 23:34 ` Jaegeuk Kim
2022-08-20 2:04 ` [f2fs-dev] " Chao Yu
1 sibling, 1 reply; 5+ messages in thread
From: Jaegeuk Kim @ 2022-08-19 23:34 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel; +Cc: stable
We should decrease the frozen counter.
Cc: stable@kernel.org
Fixes: 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
Change log from v1:
- fix by refactoring the flow
fs/f2fs/gc.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 6da21d405ce1..45f90e3c46d4 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -97,14 +97,10 @@ static int gc_thread_func(void *data)
*/
if (sbi->gc_mode == GC_URGENT_HIGH) {
spin_lock(&sbi->gc_urgent_high_lock);
- if (sbi->gc_urgent_high_limited) {
- if (!sbi->gc_urgent_high_remaining) {
- sbi->gc_urgent_high_limited = false;
- spin_unlock(&sbi->gc_urgent_high_lock);
- sbi->gc_mode = GC_NORMAL;
- continue;
- }
- sbi->gc_urgent_high_remaining--;
+ if (sbi->gc_urgent_high_limited &&
+ !sbi->gc_urgent_high_remaining--) {
+ sbi->gc_urgent_high_limited = false;
+ sbi->gc_mode = GC_NORMAL;
}
spin_unlock(&sbi->gc_urgent_high_lock);
}
--
2.37.1.595.g718a3a8f04-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH v2] f2fs: fix wrong continue condition in GC
2022-08-19 23:34 ` [PATCH v2] " Jaegeuk Kim
@ 2022-08-20 2:04 ` Chao Yu
0 siblings, 0 replies; 5+ messages in thread
From: Chao Yu @ 2022-08-20 2:04 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel; +Cc: stable
On 2022/8/20 7:34, Jaegeuk Kim wrote:
> We should decrease the frozen counter.
>
> Cc: stable@kernel.org
> Fixes: 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node")
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-20 2:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13 14:37 [PATCH] f2fs: fix wrong continue condition in GC Jaegeuk Kim
2022-08-15 3:52 ` [f2fs-dev] " Chao Yu
2022-08-19 23:33 ` Jaegeuk Kim
2022-08-19 23:34 ` [PATCH v2] " Jaegeuk Kim
2022-08-20 2:04 ` [f2fs-dev] " 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).