diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-12-07 16:25:39 -0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-01-22 14:56:35 -0800 |
commit | 1ad71a27124caf0b68ddd3c92be01aa2b2a72b2a (patch) | |
tree | 802af8c30b004b0a3c439a9b23d25a69b9aaef5e /fs/f2fs/gc.c | |
parent | 9ac1e2d88d076aa1ae9e33d44a9bbc8ae3bfa791 (diff) | |
download | linux-1ad71a27124caf0b68ddd3c92be01aa2b2a72b2a.tar.bz2 |
f2fs: add an ioctl to disable GC for specific file
This patch gives a flag to disable GC on given file, which would be useful, when
user wants to keep its block map. It also conducts in-place-update for dontmove
file.
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/gc.c')
-rw-r--r-- | fs/f2fs/gc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index d844dcb80570..33e79697e41c 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -624,6 +624,11 @@ static void move_data_block(struct inode *inode, block_t bidx, if (f2fs_is_atomic_file(inode)) goto out; + if (f2fs_is_pinned_file(inode)) { + f2fs_pin_file_control(inode, true); + goto out; + } + set_new_dnode(&dn, inode, NULL, NULL, 0); err = get_dnode_of_data(&dn, bidx, LOOKUP_NODE); if (err) @@ -720,6 +725,11 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type, if (f2fs_is_atomic_file(inode)) goto out; + if (f2fs_is_pinned_file(inode)) { + if (gc_type == FG_GC) + f2fs_pin_file_control(inode, true); + goto out; + } if (gc_type == BG_GC) { if (PageWriteback(page)) @@ -1091,6 +1101,7 @@ void build_gc_manager(struct f2fs_sb_info *sbi) sbi->fggc_threshold = div64_u64((main_count - ovp_count) * BLKS_PER_SEC(sbi), (main_count - resv_count)); + sbi->gc_pin_file_threshold = DEF_GC_FAILED_PINNED_FILES; /* give warm/cold data area from slower device */ if (sbi->s_ndevs && sbi->segs_per_sec == 1) |