diff mbox

[4/4] f2fs: avoid frequent checkpoint during f2fs_gc

Message ID 20170411001308.12881-4-jaegeuk@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jaegeuk Kim April 11, 2017, 12:13 a.m. UTC
Now we're doing SSR aggressively more than ever before, so once we reach to
the reserved_segment, f2fs_balance_fs will call f2fs_gc, which triggers
checkpoint everytime. We actually must avoid that.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/gc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Chao Yu April 11, 2017, 1:42 a.m. UTC | #1
On 2017/4/11 8:13, Jaegeuk Kim wrote:
> Now we're doing SSR aggressively more than ever before, so once we reach to
> the reserved_segment, f2fs_balance_fs will call f2fs_gc, which triggers
> checkpoint everytime. We actually must avoid that.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/gc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index e2f9b2b12b74..4a720f3394d9 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -966,7 +966,11 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
>  		 * threshold, we can make them free by checkpoint. Then, we
>  		 * secure free segments which doesn't need fggc any more.
>  		 */
> -		ret = write_checkpoint(sbi, &cpc);
> +		if (prefree_segments(sbi)) {
> +			ret = write_checkpoint(sbi, &cpc);
> +			if (ret)
> +				goto stop;
> +		}
>  		if (ret)
>  			goto stop;

We don't need redundant check here?

Otherwise, this patchset looks good to me, anyway please add:

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

>  		if (has_not_enough_free_secs(sbi, 0, 0))
>
Jaegeuk Kim April 11, 2017, 10:13 p.m. UTC | #2
On 04/11, Chao Yu wrote:
> On 2017/4/11 8:13, Jaegeuk Kim wrote:
> > Now we're doing SSR aggressively more than ever before, so once we reach to
> > the reserved_segment, f2fs_balance_fs will call f2fs_gc, which triggers
> > checkpoint everytime. We actually must avoid that.
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fs/f2fs/gc.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> > index e2f9b2b12b74..4a720f3394d9 100644
> > --- a/fs/f2fs/gc.c
> > +++ b/fs/f2fs/gc.c
> > @@ -966,7 +966,11 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
> >  		 * threshold, we can make them free by checkpoint. Then, we
> >  		 * secure free segments which doesn't need fggc any more.
> >  		 */
> > -		ret = write_checkpoint(sbi, &cpc);
> > +		if (prefree_segments(sbi)) {
> > +			ret = write_checkpoint(sbi, &cpc);
> > +			if (ret)
> > +				goto stop;
> > +		}
> >  		if (ret)
> >  			goto stop;
> 
> We don't need redundant check here?

Yup, will remove this. ;)

> 
> Otherwise, this patchset looks good to me, anyway please add:
> 
> Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> 
> Thanks,
> 
> >  		if (has_not_enough_free_secs(sbi, 0, 0))
> >
diff mbox

Patch

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index e2f9b2b12b74..4a720f3394d9 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -966,7 +966,11 @@  int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
 		 * threshold, we can make them free by checkpoint. Then, we
 		 * secure free segments which doesn't need fggc any more.
 		 */
-		ret = write_checkpoint(sbi, &cpc);
+		if (prefree_segments(sbi)) {
+			ret = write_checkpoint(sbi, &cpc);
+			if (ret)
+				goto stop;
+		}
 		if (ret)
 			goto stop;
 		if (has_not_enough_free_secs(sbi, 0, 0))