f2fs: check pinfile in gc_data_segment() in advance
authorChao Yu <chao@kernel.org>
Sun, 20 Mar 2022 15:11:17 +0000 (23:11 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 25 Apr 2022 22:13:02 +0000 (15:13 -0700)
In order to skip migrating section which contains data of pinned
file in advance.

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

index ea5b93b..e83c071 100644 (file)
@@ -1480,6 +1480,13 @@ next_step:
                                        special_file(inode->i_mode))
                                continue;
 
+                       if (is_inode_flag_set(inode, FI_PIN_FILE) &&
+                                                       gc_type == FG_GC) {
+                               f2fs_pin_file_control(inode, true);
+                               iput(inode);
+                               return submitted;
+                       }
+
                        if (!f2fs_down_write_trylock(
                                &F2FS_I(inode)->i_gc_rwsem[WRITE])) {
                                iput(inode);