Commit 1c8a8ec0 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jaegeuk Kim

f2fs: remove struct segment_allocation default_salloc_ops

There is only  single instance of these ops, so remove the indirection
and call allocate_segment_by_default directly.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 8a47d228
...@@ -2926,7 +2926,7 @@ static void __allocate_new_segment(struct f2fs_sb_info *sbi, int type, ...@@ -2926,7 +2926,7 @@ static void __allocate_new_segment(struct f2fs_sb_info *sbi, int type,
return; return;
alloc: alloc:
old_segno = curseg->segno; old_segno = curseg->segno;
SIT_I(sbi)->s_ops->allocate_segment(sbi, type, true); allocate_segment_by_default(sbi, type, true);
locate_dirty_segment(sbi, old_segno); locate_dirty_segment(sbi, old_segno);
} }
...@@ -2957,10 +2957,6 @@ void f2fs_allocate_new_segments(struct f2fs_sb_info *sbi) ...@@ -2957,10 +2957,6 @@ void f2fs_allocate_new_segments(struct f2fs_sb_info *sbi)
f2fs_up_read(&SM_I(sbi)->curseg_lock); f2fs_up_read(&SM_I(sbi)->curseg_lock);
} }
static const struct segment_allocation default_salloc_ops = {
.allocate_segment = allocate_segment_by_default,
};
bool f2fs_exist_trim_candidates(struct f2fs_sb_info *sbi, bool f2fs_exist_trim_candidates(struct f2fs_sb_info *sbi,
struct cp_control *cpc) struct cp_control *cpc)
{ {
...@@ -3284,7 +3280,7 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, ...@@ -3284,7 +3280,7 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
get_atssr_segment(sbi, type, se->type, get_atssr_segment(sbi, type, se->type,
AT_SSR, se->mtime); AT_SSR, se->mtime);
else else
sit_i->s_ops->allocate_segment(sbi, type, false); allocate_segment_by_default(sbi, type, false);
} }
/* /*
* segment dirty status should be updated after segment allocation, * segment dirty status should be updated after segment allocation,
...@@ -4270,9 +4266,6 @@ static int build_sit_info(struct f2fs_sb_info *sbi) ...@@ -4270,9 +4266,6 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
return -ENOMEM; return -ENOMEM;
#endif #endif
/* init SIT information */
sit_i->s_ops = &default_salloc_ops;
sit_i->sit_base_addr = le32_to_cpu(raw_super->sit_blkaddr); sit_i->sit_base_addr = le32_to_cpu(raw_super->sit_blkaddr);
sit_i->sit_blocks = sit_segs << sbi->log_blocks_per_seg; sit_i->sit_blocks = sit_segs << sbi->log_blocks_per_seg;
sit_i->written_valid_blocks = 0; sit_i->written_valid_blocks = 0;
......
...@@ -222,10 +222,6 @@ struct sec_entry { ...@@ -222,10 +222,6 @@ struct sec_entry {
unsigned int valid_blocks; /* # of valid blocks in a section */ unsigned int valid_blocks; /* # of valid blocks in a section */
}; };
struct segment_allocation {
void (*allocate_segment)(struct f2fs_sb_info *, int, bool);
};
#define MAX_SKIP_GC_COUNT 16 #define MAX_SKIP_GC_COUNT 16
struct revoke_entry { struct revoke_entry {
...@@ -235,8 +231,6 @@ struct revoke_entry { ...@@ -235,8 +231,6 @@ struct revoke_entry {
}; };
struct sit_info { struct sit_info {
const struct segment_allocation *s_ops;
block_t sit_base_addr; /* start block address of SIT area */ block_t sit_base_addr; /* start block address of SIT area */
block_t sit_blocks; /* # of blocks used by SIT area */ block_t sit_blocks; /* # of blocks used by SIT area */
block_t written_valid_blocks; /* # of valid blocks in main area */ block_t written_valid_blocks; /* # of valid blocks in main area */
......
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