Commit 19e0e21a authored by Yangtao Li's avatar Yangtao Li Committed by Jaegeuk Kim

f2fs: remove struct victim_selection default_v_ops

There is only single instance of these ops, and Jaegeuk point out that:

    Originally this was intended to give a chance to provide other
    allocation option. Anyway, it seems quit hard to do it anymore.

So remove the indirection and call f2fs_get_victim() directly.
Signed-off-by: default avatarYangtao Li <frank.li@vivo.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent da6ea0b0
...@@ -3815,6 +3815,10 @@ void f2fs_build_gc_manager(struct f2fs_sb_info *sbi); ...@@ -3815,6 +3815,10 @@ void f2fs_build_gc_manager(struct f2fs_sb_info *sbi);
int f2fs_resize_fs(struct f2fs_sb_info *sbi, __u64 block_count); int f2fs_resize_fs(struct f2fs_sb_info *sbi, __u64 block_count);
int __init f2fs_create_garbage_collection_cache(void); int __init f2fs_create_garbage_collection_cache(void);
void f2fs_destroy_garbage_collection_cache(void); void f2fs_destroy_garbage_collection_cache(void);
/* victim selection function for cleaning and SSR */
int f2fs_get_victim(struct f2fs_sb_info *sbi, unsigned int *result,
int gc_type, int type, char alloc_mode,
unsigned long long age);
/* /*
* recovery.c * recovery.c
......
...@@ -741,9 +741,9 @@ static int f2fs_gc_pinned_control(struct inode *inode, int gc_type, ...@@ -741,9 +741,9 @@ static int f2fs_gc_pinned_control(struct inode *inode, int gc_type,
* When it is called from SSR segment selection, it finds a segment * When it is called from SSR segment selection, it finds a segment
* which has minimum valid blocks and removes it from dirty seglist. * which has minimum valid blocks and removes it from dirty seglist.
*/ */
static int get_victim_by_default(struct f2fs_sb_info *sbi, int f2fs_get_victim(struct f2fs_sb_info *sbi, unsigned int *result,
unsigned int *result, int gc_type, int type, int gc_type, int type, char alloc_mode,
char alloc_mode, unsigned long long age) unsigned long long age)
{ {
struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
struct sit_info *sm = SIT_I(sbi); struct sit_info *sm = SIT_I(sbi);
...@@ -937,10 +937,6 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi, ...@@ -937,10 +937,6 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi,
return ret; return ret;
} }
static const struct victim_selection default_v_ops = {
.get_victim = get_victim_by_default,
};
static struct inode *find_gc_inode(struct gc_inode_list *gc_list, nid_t ino) static struct inode *find_gc_inode(struct gc_inode_list *gc_list, nid_t ino)
{ {
struct inode_entry *ie; struct inode_entry *ie;
...@@ -1671,8 +1667,7 @@ static int __get_victim(struct f2fs_sb_info *sbi, unsigned int *victim, ...@@ -1671,8 +1667,7 @@ static int __get_victim(struct f2fs_sb_info *sbi, unsigned int *victim,
int ret; int ret;
down_write(&sit_i->sentry_lock); down_write(&sit_i->sentry_lock);
ret = DIRTY_I(sbi)->v_ops->get_victim(sbi, victim, gc_type, ret = f2fs_get_victim(sbi, victim, gc_type, NO_CHECK_TYPE, LFS, 0);
NO_CHECK_TYPE, LFS, 0);
up_write(&sit_i->sentry_lock); up_write(&sit_i->sentry_lock);
return ret; return ret;
} }
...@@ -1963,8 +1958,6 @@ static void init_atgc_management(struct f2fs_sb_info *sbi) ...@@ -1963,8 +1958,6 @@ static void init_atgc_management(struct f2fs_sb_info *sbi)
void f2fs_build_gc_manager(struct f2fs_sb_info *sbi) void f2fs_build_gc_manager(struct f2fs_sb_info *sbi)
{ {
DIRTY_I(sbi)->v_ops = &default_v_ops;
sbi->gc_pin_file_threshold = DEF_GC_FAILED_PINNED_FILES; sbi->gc_pin_file_threshold = DEF_GC_FAILED_PINNED_FILES;
/* give warm/cold data area from slower device */ /* give warm/cold data area from slower device */
......
...@@ -2875,7 +2875,6 @@ static int get_ssr_segment(struct f2fs_sb_info *sbi, int type, ...@@ -2875,7 +2875,6 @@ static int get_ssr_segment(struct f2fs_sb_info *sbi, int type,
int alloc_mode, unsigned long long age) int alloc_mode, unsigned long long age)
{ {
struct curseg_info *curseg = CURSEG_I(sbi, type); struct curseg_info *curseg = CURSEG_I(sbi, type);
const struct victim_selection *v_ops = DIRTY_I(sbi)->v_ops;
unsigned segno = NULL_SEGNO; unsigned segno = NULL_SEGNO;
unsigned short seg_type = curseg->seg_type; unsigned short seg_type = curseg->seg_type;
int i, cnt; int i, cnt;
...@@ -2884,7 +2883,7 @@ static int get_ssr_segment(struct f2fs_sb_info *sbi, int type, ...@@ -2884,7 +2883,7 @@ static int get_ssr_segment(struct f2fs_sb_info *sbi, int type,
sanity_check_seg_type(sbi, seg_type); sanity_check_seg_type(sbi, seg_type);
/* f2fs_need_SSR() already forces to do this */ /* f2fs_need_SSR() already forces to do this */
if (!v_ops->get_victim(sbi, &segno, BG_GC, seg_type, alloc_mode, age)) { if (!f2fs_get_victim(sbi, &segno, BG_GC, seg_type, alloc_mode, age)) {
curseg->next_segno = segno; curseg->next_segno = segno;
return 1; return 1;
} }
...@@ -2911,7 +2910,7 @@ static int get_ssr_segment(struct f2fs_sb_info *sbi, int type, ...@@ -2911,7 +2910,7 @@ static int get_ssr_segment(struct f2fs_sb_info *sbi, int type,
for (; cnt-- > 0; reversed ? i-- : i++) { for (; cnt-- > 0; reversed ? i-- : i++) {
if (i == seg_type) if (i == seg_type)
continue; continue;
if (!v_ops->get_victim(sbi, &segno, BG_GC, i, alloc_mode, age)) { if (!f2fs_get_victim(sbi, &segno, BG_GC, i, alloc_mode, age)) {
curseg->next_segno = segno; curseg->next_segno = segno;
return 1; return 1;
} }
......
...@@ -289,7 +289,6 @@ enum dirty_type { ...@@ -289,7 +289,6 @@ enum dirty_type {
}; };
struct dirty_seglist_info { struct dirty_seglist_info {
const struct victim_selection *v_ops; /* victim selction operation */
unsigned long *dirty_segmap[NR_DIRTY_TYPE]; unsigned long *dirty_segmap[NR_DIRTY_TYPE];
unsigned long *dirty_secmap; unsigned long *dirty_secmap;
struct mutex seglist_lock; /* lock for segment bitmaps */ struct mutex seglist_lock; /* lock for segment bitmaps */
...@@ -300,12 +299,6 @@ struct dirty_seglist_info { ...@@ -300,12 +299,6 @@ struct dirty_seglist_info {
bool enable_pin_section; /* enable pinning section */ bool enable_pin_section; /* enable pinning section */
}; };
/* victim selection function for cleaning and SSR */
struct victim_selection {
int (*get_victim)(struct f2fs_sb_info *, unsigned int *,
int, int, char, unsigned long long);
};
/* for active log information */ /* for active log information */
struct curseg_info { struct curseg_info {
struct mutex curseg_mutex; /* lock for consistency */ struct mutex curseg_mutex; /* lock for consistency */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment