* [PATCH] f2fs: clean up codes in f2fs_gc related with write_checkpoint
@ 2017-02-21 12:43 ` Yunlong Song
0 siblings, 0 replies; 7+ messages in thread
From: Yunlong Song @ 2017-02-21 12:43 UTC (permalink / raw)
To: jaegeuk, cm224.lee, yuchao0, chao, sylinux, yunlong.song, miaoxie
Cc: bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
fs/f2fs/gc.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 88e5e7b..e5f2569 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -943,23 +943,15 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
* enough free sections, we should flush dent/node blocks and do
* garbage collections.
*/
- if (__get_victim(sbi, &segno, gc_type) ||
- prefree_segments(sbi)) {
- ret = write_checkpoint(sbi, &cpc);
- if (ret)
- goto stop;
- segno = NULL_SEGNO;
- } else if (has_not_enough_free_secs(sbi, 0, 0)) {
- ret = write_checkpoint(sbi, &cpc);
- if (ret)
- goto stop;
- }
+ ret = write_checkpoint(sbi, &cpc);
+ if (ret)
+ goto stop;
} else if (gc_type == BG_GC && !background) {
/* f2fs_balance_fs doesn't need to do BG_GC in critical path. */
goto stop;
}
- if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
+ if (!__get_victim(sbi, &segno, gc_type))
goto stop;
ret = 0;
--
1.8.5.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] f2fs: clean up codes in f2fs_gc related with write_checkpoint
@ 2017-02-21 12:43 ` Yunlong Song
0 siblings, 0 replies; 7+ messages in thread
From: Yunlong Song @ 2017-02-21 12:43 UTC (permalink / raw)
To: jaegeuk, cm224.lee, yuchao0, chao, sylinux, yunlong.song, miaoxie
Cc: bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
fs/f2fs/gc.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 88e5e7b..e5f2569 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -943,23 +943,15 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
* enough free sections, we should flush dent/node blocks and do
* garbage collections.
*/
- if (__get_victim(sbi, &segno, gc_type) ||
- prefree_segments(sbi)) {
- ret = write_checkpoint(sbi, &cpc);
- if (ret)
- goto stop;
- segno = NULL_SEGNO;
- } else if (has_not_enough_free_secs(sbi, 0, 0)) {
- ret = write_checkpoint(sbi, &cpc);
- if (ret)
- goto stop;
- }
+ ret = write_checkpoint(sbi, &cpc);
+ if (ret)
+ goto stop;
} else if (gc_type == BG_GC && !background) {
/* f2fs_balance_fs doesn't need to do BG_GC in critical path. */
goto stop;
}
- if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
+ if (!__get_victim(sbi, &segno, gc_type))
goto stop;
ret = 0;
--
1.8.5.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] f2fs: clean up codes in f2fs_gc related with write_checkpoint
2017-02-21 12:43 ` Yunlong Song
@ 2017-02-23 2:52 ` Yunlong Song
-1 siblings, 0 replies; 7+ messages in thread
From: Yunlong Song @ 2017-02-23 2:52 UTC (permalink / raw)
To: jaegeuk, cm224.lee, yuchao0, chao, sylinux, miaoxie
Cc: bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
Ping...
Since has_not_enough_free_secs(sbi, 0, 0) must be true if has_not_enough_free_secs(sbi, sec_freed, 0) is true,
write_checkpoint is sure to execute in both conditions, and segno is NULL_SEGNO in both conditions.
On 2017/2/21 20:43, Yunlong Song wrote:
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
> fs/f2fs/gc.c | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 88e5e7b..e5f2569 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -943,23 +943,15 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
> * enough free sections, we should flush dent/node blocks and do
> * garbage collections.
> */
> - if (__get_victim(sbi, &segno, gc_type) ||
> - prefree_segments(sbi)) {
> - ret = write_checkpoint(sbi, &cpc);
> - if (ret)
> - goto stop;
> - segno = NULL_SEGNO;
> - } else if (has_not_enough_free_secs(sbi, 0, 0)) {
> - ret = write_checkpoint(sbi, &cpc);
> - if (ret)
> - goto stop;
> - }
> + ret = write_checkpoint(sbi, &cpc);
> + if (ret)
> + goto stop;
> } else if (gc_type == BG_GC && !background) {
> /* f2fs_balance_fs doesn't need to do BG_GC in critical path. */
> goto stop;
> }
>
> - if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
> + if (!__get_victim(sbi, &segno, gc_type))
> goto stop;
> ret = 0;
>
--
Thanks,
Yunlong Song
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] f2fs: clean up codes in f2fs_gc related with write_checkpoint
@ 2017-02-23 2:52 ` Yunlong Song
0 siblings, 0 replies; 7+ messages in thread
From: Yunlong Song @ 2017-02-23 2:52 UTC (permalink / raw)
To: jaegeuk, cm224.lee, yuchao0, chao, sylinux, miaoxie
Cc: bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
Ping...
Since has_not_enough_free_secs(sbi, 0, 0) must be true if has_not_enough_free_secs(sbi, sec_freed, 0) is true,
write_checkpoint is sure to execute in both conditions, and segno is NULL_SEGNO in both conditions.
On 2017/2/21 20:43, Yunlong Song wrote:
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
> fs/f2fs/gc.c | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 88e5e7b..e5f2569 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -943,23 +943,15 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
> * enough free sections, we should flush dent/node blocks and do
> * garbage collections.
> */
> - if (__get_victim(sbi, &segno, gc_type) ||
> - prefree_segments(sbi)) {
> - ret = write_checkpoint(sbi, &cpc);
> - if (ret)
> - goto stop;
> - segno = NULL_SEGNO;
> - } else if (has_not_enough_free_secs(sbi, 0, 0)) {
> - ret = write_checkpoint(sbi, &cpc);
> - if (ret)
> - goto stop;
> - }
> + ret = write_checkpoint(sbi, &cpc);
> + if (ret)
> + goto stop;
> } else if (gc_type == BG_GC && !background) {
> /* f2fs_balance_fs doesn't need to do BG_GC in critical path. */
> goto stop;
> }
>
> - if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
> + if (!__get_victim(sbi, &segno, gc_type))
> goto stop;
> ret = 0;
>
--
Thanks,
Yunlong Song
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] f2fs: clean up codes in f2fs_gc related with write_checkpoint
2017-02-23 2:52 ` Yunlong Song
(?)
@ 2017-02-23 4:51 ` Jaegeuk Kim
-1 siblings, 0 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2017-02-23 4:51 UTC (permalink / raw)
To: Yunlong Song
Cc: cm224.lee, yuchao0, chao, sylinux, miaoxie, bintian.wang,
linux-fsdevel, linux-f2fs-devel, linux-kernel
On 02/23, Yunlong Song wrote:
> Ping...
>
> Since has_not_enough_free_secs(sbi, 0, 0) must be true if has_not_enough_free_secs(sbi, sec_freed, 0) is true,
> write_checkpoint is sure to execute in both conditions, and segno is NULL_SEGNO in both conditions.
Looks good to me, but applied like below.
>From 49aea5513fd20d29dace9067de2e931d03ae2202 Mon Sep 17 00:00:00 2001
From: Yunlong Song <yunlong.song@huawei.com>
Date: Tue, 21 Feb 2017 20:43:48 +0800
Subject: [PATCH] f2fs: remove unnecessary condition check for write_checkpoint
in f2fs_gc
Since has_not_enough_free_secs(sbi, 0, 0) must be true if has_not_enough_
free_secs(sbi, sec_freed, 0) is true, write_checkpoint is sure to execute in
both conditions.
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/gc.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 11416c7cb705..6c996e39b59a 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -958,15 +958,9 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
* enough free sections, we should flush dent/node blocks and do
* garbage collections.
*/
- if (dirty_segments(sbi) || prefree_segments(sbi)) {
- ret = write_checkpoint(sbi, &cpc);
- if (ret)
- goto stop;
- } else if (has_not_enough_free_secs(sbi, 0, 0)) {
- ret = write_checkpoint(sbi, &cpc);
- if (ret)
- goto stop;
- }
+ ret = write_checkpoint(sbi, &cpc);
+ if (ret)
+ goto stop;
} else if (gc_type == BG_GC && !background) {
/* f2fs_balance_fs doesn't need to do BG_GC in critical path. */
goto stop;
--
2.11.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] f2fs: clean up codes in f2fs_gc related with write_checkpoint
2017-02-21 12:43 ` Yunlong Song
@ 2017-02-24 1:40 ` Chao Yu
-1 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2017-02-24 1:40 UTC (permalink / raw)
To: Yunlong Song, jaegeuk, cm224.lee, chao, sylinux, miaoxie
Cc: bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
3On 2017/2/21 20:43, Yunlong Song wrote:
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] f2fs: clean up codes in f2fs_gc related with write_checkpoint
@ 2017-02-24 1:40 ` Chao Yu
0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2017-02-24 1:40 UTC (permalink / raw)
To: Yunlong Song, jaegeuk, cm224.lee, chao, sylinux, miaoxie
Cc: bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
3On 2017/2/21 20:43, Yunlong Song wrote:
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-02-24 1:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21 12:43 [PATCH] f2fs: clean up codes in f2fs_gc related with write_checkpoint Yunlong Song
2017-02-21 12:43 ` Yunlong Song
2017-02-23 2:52 ` Yunlong Song
2017-02-23 2:52 ` Yunlong Song
2017-02-23 4:51 ` Jaegeuk Kim
2017-02-24 1:40 ` Chao Yu
2017-02-24 1:40 ` 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.