Skip to content

Commit fa08972

Browse files
Daeho JeongJaegeuk Kim
authored andcommitted
f2fs: decrease spare area for pinned files for zoned devices
Now we reclaim too much space before allocating pinned space for zoned devices. Signed-off-by: Daeho Jeong <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 2d56b4e commit fa08972

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

fs/f2fs/file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,8 @@ static int f2fs_expand_inode_data(struct inode *inode, loff_t offset,
17901790

17911791
map.m_len = sec_blks;
17921792
next_alloc:
1793-
if (has_not_enough_free_secs(sbi, 0,
1793+
if (has_not_enough_free_secs(sbi, 0, f2fs_sb_has_blkzoned(sbi) ?
1794+
ZONED_PIN_SEC_REQUIRED_COUNT :
17941795
GET_SEC_FROM_SEG(sbi, overprovision_segments(sbi)))) {
17951796
f2fs_down_write(&sbi->gc_lock);
17961797
stat_inc_gc_call_count(sbi, FOREGROUND);

fs/f2fs/gc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#define LIMIT_BOOST_ZONED_GC 25 /* percentage over total user space of boosted gc for zoned devices */
3636
#define DEF_MIGRATION_WINDOW_GRANULARITY_ZONED 3
3737
#define BOOST_GC_MULTIPLE 5
38+
#define ZONED_PIN_SEC_REQUIRED_COUNT 1
3839

3940
#define DEF_GC_FAILED_PINNED_FILES 2048
4041
#define MAX_GC_FAILED_PINNED_FILES USHRT_MAX

fs/f2fs/segment.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3237,7 +3237,8 @@ int f2fs_allocate_pinning_section(struct f2fs_sb_info *sbi)
32373237

32383238
if (f2fs_sb_has_blkzoned(sbi) && err == -EAGAIN && gc_required) {
32393239
f2fs_down_write(&sbi->gc_lock);
3240-
err = f2fs_gc_range(sbi, 0, GET_SEGNO(sbi, FDEV(0).end_blk), true, 1);
3240+
err = f2fs_gc_range(sbi, 0, GET_SEGNO(sbi, FDEV(0).end_blk),
3241+
true, ZONED_PIN_SEC_REQUIRED_COUNT);
32413242
f2fs_up_write(&sbi->gc_lock);
32423243

32433244
gc_required = false;

0 commit comments

Comments
 (0)