f2fs: don't set GC_FAILURE_PIN for background GC
authorChao Yu <chao@kernel.org>
Sun, 20 Mar 2022 15:11:18 +0000 (23:11 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 25 Apr 2022 22:13:02 +0000 (15:13 -0700)
So that it can reduce the possibility that file be unpinned forcely by
foreground GC due to .i_gc_failures[GC_FAILURE_PIN] exceeds threshold.

Signed-off-by: Chao Yu <chao.yu@oppo.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/gc.c

index e83c07144d8f3b1a91ccb29856ca1430fd1d7225..6a7e4148ff9d9f82a553cc5c454dffacd332bf08 100644 (file)
@@ -1202,7 +1202,8 @@ static int move_data_block(struct inode *inode, block_t bidx,
        }
 
        if (f2fs_is_pinned_file(inode)) {
-               f2fs_pin_file_control(inode, true);
+               if (gc_type == FG_GC)
+                       f2fs_pin_file_control(inode, true);
                err = -EAGAIN;
                goto out;
        }