summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorChao Yu <chao@kernel.org>2022-05-06 12:30:31 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2022-05-06 23:26:33 +0200
commit71419129625a50cfb5e3c5cc215948a3f98c806d (patch)
tree1c98cc9d1aa6447472d0f9eaa72237fccdb44a27 /fs/f2fs/segment.c
parentf2fs: fix to do sanity check on total_data_blocks (diff)
downloadlinux-71419129625a50cfb5e3c5cc215948a3f98c806d.tar.xz
linux-71419129625a50cfb5e3c5cc215948a3f98c806d.zip
f2fs: give priority to select unpinned section for foreground GC
Previously, during foreground GC, if victims contain data of pinned file, it will fail migration of the data, and meanwhile i_gc_failures of that pinned file may increase, and when it exceeds threshold, GC will unpin the file, result in breaking pinfile's semantics. In order to mitigate such condition, let's record and skip section which has pinned file's data and give priority to select unpinned one. Signed-off-by: Chao Yu <chao.yu@oppo.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 388bedc9b5da..87ff2b3cdf94 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -4654,6 +4654,13 @@ static int init_victim_secmap(struct f2fs_sb_info *sbi)
dirty_i->victim_secmap = f2fs_kvzalloc(sbi, bitmap_size, GFP_KERNEL);
if (!dirty_i->victim_secmap)
return -ENOMEM;
+
+ dirty_i->pinned_secmap = f2fs_kvzalloc(sbi, bitmap_size, GFP_KERNEL);
+ if (!dirty_i->pinned_secmap)
+ return -ENOMEM;
+
+ dirty_i->pinned_secmap_cnt = 0;
+ dirty_i->enable_pin_section = true;
return 0;
}
@@ -5242,6 +5249,7 @@ static void destroy_victim_secmap(struct f2fs_sb_info *sbi)
{
struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
+ kvfree(dirty_i->pinned_secmap);
kvfree(dirty_i->victim_secmap);
}