summaryrefslogtreecommitdiff
path: root/fs/f2fs/gc.c
diff options
context:
space:
mode:
authorDaeho Jeong <daehojeong@google.com>2024-02-13 09:38:12 -0800
committerJaegeuk Kim <jaegeuk@kernel.org>2024-02-27 09:41:15 -0800
commit9703d69d9d153bb230711d0d577454552aeb13d4 (patch)
tree907a5ec0ac2f88d36437bbdea4e5054eaf7e155f /fs/f2fs/gc.c
parent4e0197f9932f70cc7be8744aa0ed4dd9b5d97d85 (diff)
f2fs: support file pinning for zoned devices
Support file pinning with conventional storage area for zoned devices Signed-off-by: Daeho Jeong <daehojeong@google.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/gc.c')
-rw-r--r--fs/f2fs/gc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index c97d80e3b726..d194097c3da0 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -1974,10 +1974,12 @@ void f2fs_build_gc_manager(struct f2fs_sb_info *sbi)
init_atgc_management(sbi);
}
-static int f2fs_gc_range(struct f2fs_sb_info *sbi,
- unsigned int start_seg, unsigned int end_seg, bool dry_run)
+int f2fs_gc_range(struct f2fs_sb_info *sbi,
+ unsigned int start_seg, unsigned int end_seg,
+ bool dry_run, unsigned int dry_run_sections)
{
unsigned int segno;
+ unsigned int gc_secs = dry_run_sections;
for (segno = start_seg; segno <= end_seg; segno += SEGS_PER_SEC(sbi)) {
struct gc_inode_list gc_list = {
@@ -1985,11 +1987,15 @@ static int f2fs_gc_range(struct f2fs_sb_info *sbi,
.iroot = RADIX_TREE_INIT(gc_list.iroot, GFP_NOFS),
};
- do_garbage_collect(sbi, segno, &gc_list, FG_GC, true);
+ do_garbage_collect(sbi, segno, &gc_list, FG_GC,
+ dry_run_sections == 0);
put_gc_inode(&gc_list);
if (!dry_run && get_valid_blocks(sbi, segno, true))
return -EAGAIN;
+ if (dry_run && dry_run_sections &&
+ !get_valid_blocks(sbi, segno, true) && --gc_secs == 0)
+ break;
if (fatal_signal_pending(current))
return -ERESTARTSYS;
@@ -2027,7 +2033,7 @@ static int free_segment_range(struct f2fs_sb_info *sbi,
f2fs_allocate_segment_for_resize(sbi, type, start, end);
/* do GC to move out valid blocks in the range */
- err = f2fs_gc_range(sbi, start, end, dry_run);
+ err = f2fs_gc_range(sbi, start, end, dry_run, 0);
if (err || dry_run)
goto out;