f2fs: wake up discard_thread iff there is a candidate
This patch fixes to avoid needless wake ups. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
@ -1494,8 +1494,7 @@ skip:
|
|||||||
kmem_cache_free(discard_entry_slab, entry);
|
kmem_cache_free(discard_entry_slab, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcc->discard_wake = 1;
|
wake_up_discard_thread(sbi, false);
|
||||||
wake_up_interruptible_all(&dcc->discard_wait_queue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int create_discard_cmd_control(struct f2fs_sb_info *sbi)
|
static int create_discard_cmd_control(struct f2fs_sb_info *sbi)
|
||||||
|
@ -798,3 +798,28 @@ static inline long nr_pages_to_write(struct f2fs_sb_info *sbi, int type,
|
|||||||
wbc->nr_to_write = desired;
|
wbc->nr_to_write = desired;
|
||||||
return desired - nr_to_write;
|
return desired - nr_to_write;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void wake_up_discard_thread(struct f2fs_sb_info *sbi, bool force)
|
||||||
|
{
|
||||||
|
struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
|
||||||
|
bool wakeup = false;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (force)
|
||||||
|
goto wake_up;
|
||||||
|
|
||||||
|
mutex_lock(&dcc->cmd_lock);
|
||||||
|
for (i = MAX_PLIST_NUM - 1;
|
||||||
|
i >= 0 && plist_issue(dcc->pend_list_tag[i]); i--) {
|
||||||
|
if (!list_empty(&dcc->pend_list[i])) {
|
||||||
|
wakeup = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mutex_unlock(&dcc->cmd_lock);
|
||||||
|
if (!wakeup)
|
||||||
|
return;
|
||||||
|
wake_up:
|
||||||
|
dcc->discard_wake = 1;
|
||||||
|
wake_up_interruptible_all(&dcc->discard_wait_queue);
|
||||||
|
}
|
||||||
|
@ -178,13 +178,9 @@ static ssize_t f2fs_sbi_store(struct f2fs_attr *a,
|
|||||||
if (!strcmp(a->attr.name, "iostat_enable") && *ui == 0)
|
if (!strcmp(a->attr.name, "iostat_enable") && *ui == 0)
|
||||||
f2fs_reset_iostat(sbi);
|
f2fs_reset_iostat(sbi);
|
||||||
if (!strcmp(a->attr.name, "gc_urgent") && t == 1 && sbi->gc_thread) {
|
if (!strcmp(a->attr.name, "gc_urgent") && t == 1 && sbi->gc_thread) {
|
||||||
struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
|
|
||||||
|
|
||||||
sbi->gc_thread->gc_wake = 1;
|
sbi->gc_thread->gc_wake = 1;
|
||||||
wake_up_interruptible_all(&sbi->gc_thread->gc_wait_queue_head);
|
wake_up_interruptible_all(&sbi->gc_thread->gc_wait_queue_head);
|
||||||
|
wake_up_discard_thread(sbi, true);
|
||||||
dcc->discard_wake = 1;
|
|
||||||
wake_up_interruptible_all(&dcc->discard_wait_queue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
Reference in New Issue
Block a user