f2fs: fix return val in f2fs_start_ckpt_thread()
Return PTR_ERR(cprc->f2fs_issue_ckpt) instead of -ENOMEM; Signed-off-by: Yangtao Li <frank.li@vivo.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
@@ -1903,8 +1903,10 @@ int f2fs_start_ckpt_thread(struct f2fs_sb_info *sbi)
|
|||||||
cprc->f2fs_issue_ckpt = kthread_run(issue_checkpoint_thread, sbi,
|
cprc->f2fs_issue_ckpt = kthread_run(issue_checkpoint_thread, sbi,
|
||||||
"f2fs_ckpt-%u:%u", MAJOR(dev), MINOR(dev));
|
"f2fs_ckpt-%u:%u", MAJOR(dev), MINOR(dev));
|
||||||
if (IS_ERR(cprc->f2fs_issue_ckpt)) {
|
if (IS_ERR(cprc->f2fs_issue_ckpt)) {
|
||||||
|
int err = PTR_ERR(cprc->f2fs_issue_ckpt);
|
||||||
|
|
||||||
cprc->f2fs_issue_ckpt = NULL;
|
cprc->f2fs_issue_ckpt = NULL;
|
||||||
return -ENOMEM;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_task_ioprio(cprc->f2fs_issue_ckpt, cprc->ckpt_thread_ioprio);
|
set_task_ioprio(cprc->f2fs_issue_ckpt, cprc->ckpt_thread_ioprio);
|
||||||
|
|||||||
15
fs/f2fs/gc.c
15
fs/f2fs/gc.c
@@ -171,13 +171,10 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi)
|
|||||||
{
|
{
|
||||||
struct f2fs_gc_kthread *gc_th;
|
struct f2fs_gc_kthread *gc_th;
|
||||||
dev_t dev = sbi->sb->s_bdev->bd_dev;
|
dev_t dev = sbi->sb->s_bdev->bd_dev;
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
gc_th = f2fs_kmalloc(sbi, sizeof(struct f2fs_gc_kthread), GFP_KERNEL);
|
gc_th = f2fs_kmalloc(sbi, sizeof(struct f2fs_gc_kthread), GFP_KERNEL);
|
||||||
if (!gc_th) {
|
if (!gc_th)
|
||||||
err = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
gc_th->urgent_sleep_time = DEF_GC_THREAD_URGENT_SLEEP_TIME;
|
gc_th->urgent_sleep_time = DEF_GC_THREAD_URGENT_SLEEP_TIME;
|
||||||
gc_th->min_sleep_time = DEF_GC_THREAD_MIN_SLEEP_TIME;
|
gc_th->min_sleep_time = DEF_GC_THREAD_MIN_SLEEP_TIME;
|
||||||
@@ -192,12 +189,14 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi)
|
|||||||
sbi->gc_thread->f2fs_gc_task = kthread_run(gc_thread_func, sbi,
|
sbi->gc_thread->f2fs_gc_task = kthread_run(gc_thread_func, sbi,
|
||||||
"f2fs_gc-%u:%u", MAJOR(dev), MINOR(dev));
|
"f2fs_gc-%u:%u", MAJOR(dev), MINOR(dev));
|
||||||
if (IS_ERR(gc_th->f2fs_gc_task)) {
|
if (IS_ERR(gc_th->f2fs_gc_task)) {
|
||||||
err = PTR_ERR(gc_th->f2fs_gc_task);
|
int err = PTR_ERR(gc_th->f2fs_gc_task);
|
||||||
|
|
||||||
kfree(gc_th);
|
kfree(gc_th);
|
||||||
sbi->gc_thread = NULL;
|
sbi->gc_thread = NULL;
|
||||||
}
|
|
||||||
out:
|
|
||||||
return err;
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void f2fs_stop_gc_thread(struct f2fs_sb_info *sbi)
|
void f2fs_stop_gc_thread(struct f2fs_sb_info *sbi)
|
||||||
|
|||||||
@@ -619,7 +619,6 @@ int f2fs_create_flush_cmd_control(struct f2fs_sb_info *sbi)
|
|||||||
{
|
{
|
||||||
dev_t dev = sbi->sb->s_bdev->bd_dev;
|
dev_t dev = sbi->sb->s_bdev->bd_dev;
|
||||||
struct flush_cmd_control *fcc;
|
struct flush_cmd_control *fcc;
|
||||||
int err;
|
|
||||||
|
|
||||||
if (SM_I(sbi)->fcc_info) {
|
if (SM_I(sbi)->fcc_info) {
|
||||||
fcc = SM_I(sbi)->fcc_info;
|
fcc = SM_I(sbi)->fcc_info;
|
||||||
@@ -643,7 +642,8 @@ init_thread:
|
|||||||
fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi,
|
fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi,
|
||||||
"f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev));
|
"f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev));
|
||||||
if (IS_ERR(fcc->f2fs_issue_flush)) {
|
if (IS_ERR(fcc->f2fs_issue_flush)) {
|
||||||
err = PTR_ERR(fcc->f2fs_issue_flush);
|
int err = PTR_ERR(fcc->f2fs_issue_flush);
|
||||||
|
|
||||||
kfree(fcc);
|
kfree(fcc);
|
||||||
SM_I(sbi)->fcc_info = NULL;
|
SM_I(sbi)->fcc_info = NULL;
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
Reference in New Issue
Block a user