diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index b197a2f2993a3f7c48e5d8e84c80ab7759101d8b..657683c9ee48103cb25d22f70e0c72caee8a0d24 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -96,8 +96,6 @@ int start_gc_thread(struct f2fs_sb_info *sbi) dev_t dev = sbi->sb->s_bdev->bd_dev; int err = 0; - if (!test_opt(sbi, BG_GC)) - goto out; gc_th = kmalloc(sizeof(struct f2fs_gc_kthread), GFP_KERNEL); if (!gc_th) { err = -ENOMEM; diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 512ffd8e16242edf48a3526c62d1c3e9e2a713e2..536d414017481d0b9eca210513459f8cab33d48d 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1138,7 +1138,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) * If filesystem is not mounted as read-only then * do start the gc_thread. */ - if (!f2fs_readonly(sb)) { + if (test_opt(sbi, BG_GC) && !f2fs_readonly(sb)) { /* After POR, we can run background GC thread.*/ err = start_gc_thread(sbi); if (err)