Commit f099405f authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: clean up destroy_discard_cmd_control

Remove unneeded parameter and simply change flow in
destroy_discard_cmd_control.
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 5f32366a
...@@ -1167,20 +1167,22 @@ static int create_discard_cmd_control(struct f2fs_sb_info *sbi) ...@@ -1167,20 +1167,22 @@ static int create_discard_cmd_control(struct f2fs_sb_info *sbi)
return err; return err;
} }
static void destroy_discard_cmd_control(struct f2fs_sb_info *sbi, bool free) static void destroy_discard_cmd_control(struct f2fs_sb_info *sbi)
{ {
struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
if (dcc && dcc->f2fs_issue_discard) { if (!dcc)
return;
if (dcc->f2fs_issue_discard) {
struct task_struct *discard_thread = dcc->f2fs_issue_discard; struct task_struct *discard_thread = dcc->f2fs_issue_discard;
dcc->f2fs_issue_discard = NULL; dcc->f2fs_issue_discard = NULL;
kthread_stop(discard_thread); kthread_stop(discard_thread);
} }
if (free) {
kfree(dcc); kfree(dcc);
SM_I(sbi)->dcc_info = NULL; SM_I(sbi)->dcc_info = NULL;
}
} }
static bool __mark_sit_entry_dirty(struct f2fs_sb_info *sbi, unsigned int segno) static bool __mark_sit_entry_dirty(struct f2fs_sb_info *sbi, unsigned int segno)
...@@ -3073,7 +3075,7 @@ void destroy_segment_manager(struct f2fs_sb_info *sbi) ...@@ -3073,7 +3075,7 @@ void destroy_segment_manager(struct f2fs_sb_info *sbi)
if (!sm_info) if (!sm_info)
return; return;
destroy_flush_cmd_control(sbi, true); destroy_flush_cmd_control(sbi, true);
destroy_discard_cmd_control(sbi, true); destroy_discard_cmd_control(sbi);
destroy_dirty_segmap(sbi); destroy_dirty_segmap(sbi);
destroy_curseg(sbi); destroy_curseg(sbi);
destroy_free_segmap(sbi); destroy_free_segmap(sbi);
......
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