f2fs: do not use AT_SSR mode in FG_GC & high urgent BG_GC
authorWeichao Guo <guoweichao@oppo.com>
Wed, 17 Mar 2021 09:27:23 +0000 (17:27 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 26 Mar 2021 01:20:50 +0000 (18:20 -0700)
AT_SSR mode is introduced by age threshold based GC for better
hot/cold data seperation and avoiding free segment cost. However,
LFS write mode is preferred in the scenario of foreground or high
urgent GC, which should be finished ASAP. Let's only use AT_SSR
in background GC and not high urgent GC modes.

Signed-off-by: Weichao Guo <guoweichao@oppo.com>
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/gc.c
fs/f2fs/segment.c

index 86ba8ed0b8a74271211156e6d51efe97cad07d68..d96acc6531f2a0ebd0a7b5d6c48675bcdda419d4 100644 (file)
@@ -1120,7 +1120,8 @@ static int move_data_block(struct inode *inode, block_t bidx,
        block_t newaddr;
        int err = 0;
        bool lfs_mode = f2fs_lfs_mode(fio.sbi);
-       int type = fio.sbi->am.atgc_enabled ?
+       int type = fio.sbi->am.atgc_enabled && (gc_type == BG_GC) &&
+                               (fio.sbi->gc_mode != GC_URGENT_HIGH) ?
                                CURSEG_ALL_DATA_ATGC : CURSEG_COLD_DATA;
 
        /* do not read out */
index f2b22da8c1349284c72ecc56824225c6cfdb915e..b6f19518afd19a33c628a96c2a5a9e051fee1045 100644 (file)
@@ -3263,7 +3263,9 @@ static int __get_segment_type_6(struct f2fs_io_info *fio)
                struct inode *inode = fio->page->mapping->host;
 
                if (is_cold_data(fio->page)) {
-                       if (fio->sbi->am.atgc_enabled)
+                       if (fio->sbi->am.atgc_enabled &&
+                               (fio->io_type == FS_DATA_IO) &&
+                               (fio->sbi->gc_mode != GC_URGENT_HIGH))
                                return CURSEG_ALL_DATA_ATGC;
                        else
                                return CURSEG_COLD_DATA;