Lines Matching refs:dcc
1018 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __create_discard_cmd() local
1024 pend_list = &dcc->pend_list[plist_idx(len)]; in __create_discard_cmd()
1040 atomic_inc(&dcc->discard_cmd_cnt); in __create_discard_cmd()
1041 dcc->undiscard_blks += len; in __create_discard_cmd()
1052 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __attach_discard_cmd() local
1058 rb_insert_color_cached(&dc->rb_node, &dcc->root, leftmost); in __attach_discard_cmd()
1063 static void __detach_discard_cmd(struct discard_cmd_control *dcc, in __detach_discard_cmd() argument
1067 atomic_sub(dc->queued, &dcc->queued_discard); in __detach_discard_cmd()
1070 rb_erase_cached(&dc->rb_node, &dcc->root); in __detach_discard_cmd()
1071 dcc->undiscard_blks -= dc->len; in __detach_discard_cmd()
1075 atomic_dec(&dcc->discard_cmd_cnt); in __detach_discard_cmd()
1081 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __remove_discard_cmd() local
1103 __detach_discard_cmd(dcc, dc); in __remove_discard_cmd()
1154 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __init_discard_policy() local
1175 if (atomic_read(&dcc->discard_cmd_cnt)) in __init_discard_policy()
1207 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __submit_discard_cmd() local
1209 &(dcc->fstrim_list) : &(dcc->wait_list); in __submit_discard_cmd()
1278 atomic_inc(&dcc->queued_discard); in __submit_discard_cmd()
1290 atomic_inc(&dcc->issued_discard); in __submit_discard_cmd()
1301 dcc->undiscard_blks -= len; in __submit_discard_cmd()
1313 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __insert_discard_tree() local
1324 p = f2fs_lookup_rb_tree_for_insert(sbi, &dcc->root, &parent, in __insert_discard_tree()
1331 static void __relocate_discard_cmd(struct discard_cmd_control *dcc, in __relocate_discard_cmd() argument
1334 list_move_tail(&dc->list, &dcc->pend_list[plist_idx(dc->len)]); in __relocate_discard_cmd()
1340 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __punch_discard_cmd() local
1349 dcc->undiscard_blks -= di.len; in __punch_discard_cmd()
1353 dcc->undiscard_blks += dc->len; in __punch_discard_cmd()
1354 __relocate_discard_cmd(dcc, dc); in __punch_discard_cmd()
1368 dcc->undiscard_blks += dc->len; in __punch_discard_cmd()
1369 __relocate_discard_cmd(dcc, dc); in __punch_discard_cmd()
1378 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __update_discard_tree_range() local
1388 dc = (struct discard_cmd *)f2fs_lookup_rb_tree_ret(&dcc->root, in __update_discard_tree_range()
1430 dcc->undiscard_blks += di.len; in __update_discard_tree_range()
1431 __relocate_discard_cmd(dcc, prev_dc); in __update_discard_tree_range()
1444 dcc->undiscard_blks += di.len; in __update_discard_tree_range()
1445 __relocate_discard_cmd(dcc, next_dc); in __update_discard_tree_range()
1489 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __issue_discard_cmd_orderly() local
1494 unsigned int pos = dcc->next_pos; in __issue_discard_cmd_orderly()
1498 mutex_lock(&dcc->cmd_lock); in __issue_discard_cmd_orderly()
1499 dc = (struct discard_cmd *)f2fs_lookup_rb_tree_ret(&dcc->root, in __issue_discard_cmd_orderly()
1521 dcc->next_pos = dc->lstart + dc->len; in __issue_discard_cmd_orderly()
1536 dcc->next_pos = 0; in __issue_discard_cmd_orderly()
1538 mutex_unlock(&dcc->cmd_lock); in __issue_discard_cmd_orderly()
1551 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __issue_discard_cmd() local
1574 pend_list = &dcc->pend_list[i]; in __issue_discard_cmd()
1576 mutex_lock(&dcc->cmd_lock); in __issue_discard_cmd()
1579 if (unlikely(dcc->rbtree_check)) in __issue_discard_cmd()
1581 &dcc->root, false)); in __issue_discard_cmd()
1603 mutex_unlock(&dcc->cmd_lock); in __issue_discard_cmd()
1622 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __drop_discard_cmd() local
1628 mutex_lock(&dcc->cmd_lock); in __drop_discard_cmd()
1630 pend_list = &dcc->pend_list[i]; in __drop_discard_cmd()
1637 mutex_unlock(&dcc->cmd_lock); in __drop_discard_cmd()
1650 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __wait_one_discard_bio() local
1654 mutex_lock(&dcc->cmd_lock); in __wait_one_discard_bio()
1662 mutex_unlock(&dcc->cmd_lock); in __wait_one_discard_bio()
1671 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __wait_discard_cmd_range() local
1673 &(dcc->fstrim_list) : &(dcc->wait_list); in __wait_discard_cmd_range()
1681 mutex_lock(&dcc->cmd_lock); in __wait_discard_cmd_range()
1698 mutex_unlock(&dcc->cmd_lock); in __wait_discard_cmd_range()
1729 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_wait_discard_bio() local
1733 mutex_lock(&dcc->cmd_lock); in f2fs_wait_discard_bio()
1734 dc = (struct discard_cmd *)f2fs_lookup_rb_tree(&dcc->root, in f2fs_wait_discard_bio()
1744 mutex_unlock(&dcc->cmd_lock); in f2fs_wait_discard_bio()
1752 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_stop_discard_thread() local
1754 if (dcc && dcc->f2fs_issue_discard) { in f2fs_stop_discard_thread()
1755 struct task_struct *discard_thread = dcc->f2fs_issue_discard; in f2fs_stop_discard_thread()
1757 dcc->f2fs_issue_discard = NULL; in f2fs_stop_discard_thread()
1765 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_issue_discard_timeout() local
1770 dcc->discard_granularity); in f2fs_issue_discard_timeout()
1777 f2fs_bug_on(sbi, atomic_read(&dcc->discard_cmd_cnt)); in f2fs_issue_discard_timeout()
1784 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in issue_discard_thread() local
1785 wait_queue_head_t *q = &dcc->discard_wait_queue; in issue_discard_thread()
1798 dcc->discard_granularity); in issue_discard_thread()
1800 if (!atomic_read(&dcc->discard_cmd_cnt)) in issue_discard_thread()
1805 dcc->discard_wake, in issue_discard_thread()
1808 if (dcc->discard_wake) in issue_discard_thread()
1809 dcc->discard_wake = 0; in issue_discard_thread()
1812 if (atomic_read(&dcc->queued_discard)) in issue_discard_thread()
1825 if (!atomic_read(&dcc->discard_cmd_cnt)) in issue_discard_thread()
2033 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_clear_prefree_segments() local
2034 struct list_head *head = &dcc->entry_list; in f2fs_clear_prefree_segments()
2131 dcc->nr_discards -= total_len; in f2fs_clear_prefree_segments()
2141 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_start_discard_thread() local
2147 dcc->f2fs_issue_discard = kthread_run(issue_discard_thread, sbi, in f2fs_start_discard_thread()
2149 if (IS_ERR(dcc->f2fs_issue_discard)) in f2fs_start_discard_thread()
2150 err = PTR_ERR(dcc->f2fs_issue_discard); in f2fs_start_discard_thread()
2157 struct discard_cmd_control *dcc; in create_discard_cmd_control() local
2161 dcc = SM_I(sbi)->dcc_info; in create_discard_cmd_control()
2165 dcc = f2fs_kzalloc(sbi, sizeof(struct discard_cmd_control), GFP_KERNEL); in create_discard_cmd_control()
2166 if (!dcc) in create_discard_cmd_control()
2169 dcc->discard_granularity = DEFAULT_DISCARD_GRANULARITY; in create_discard_cmd_control()
2171 dcc->discard_granularity = sbi->blocks_per_seg; in create_discard_cmd_control()
2173 dcc->discard_granularity = BLKS_PER_SEC(sbi); in create_discard_cmd_control()
2175 INIT_LIST_HEAD(&dcc->entry_list); in create_discard_cmd_control()
2177 INIT_LIST_HEAD(&dcc->pend_list[i]); in create_discard_cmd_control()
2178 INIT_LIST_HEAD(&dcc->wait_list); in create_discard_cmd_control()
2179 INIT_LIST_HEAD(&dcc->fstrim_list); in create_discard_cmd_control()
2180 mutex_init(&dcc->cmd_lock); in create_discard_cmd_control()
2181 atomic_set(&dcc->issued_discard, 0); in create_discard_cmd_control()
2182 atomic_set(&dcc->queued_discard, 0); in create_discard_cmd_control()
2183 atomic_set(&dcc->discard_cmd_cnt, 0); in create_discard_cmd_control()
2184 dcc->nr_discards = 0; in create_discard_cmd_control()
2185 dcc->max_discards = MAIN_SEGS(sbi) << sbi->log_blocks_per_seg; in create_discard_cmd_control()
2186 dcc->undiscard_blks = 0; in create_discard_cmd_control()
2187 dcc->next_pos = 0; in create_discard_cmd_control()
2188 dcc->root = RB_ROOT_CACHED; in create_discard_cmd_control()
2189 dcc->rbtree_check = false; in create_discard_cmd_control()
2191 init_waitqueue_head(&dcc->discard_wait_queue); in create_discard_cmd_control()
2192 SM_I(sbi)->dcc_info = dcc; in create_discard_cmd_control()
2196 kfree(dcc); in create_discard_cmd_control()
2205 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in destroy_discard_cmd_control() local
2207 if (!dcc) in destroy_discard_cmd_control()
2216 if (unlikely(atomic_read(&dcc->discard_cmd_cnt))) in destroy_discard_cmd_control()
2219 kfree(dcc); in destroy_discard_cmd_control()
3090 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __issue_discard_cmd_range() local
3101 mutex_lock(&dcc->cmd_lock); in __issue_discard_cmd_range()
3102 if (unlikely(dcc->rbtree_check)) in __issue_discard_cmd_range()
3104 &dcc->root, false)); in __issue_discard_cmd_range()
3106 dc = (struct discard_cmd *)f2fs_lookup_rb_tree_ret(&dcc->root, in __issue_discard_cmd_range()
3124 list_move_tail(&dc->list, &dcc->fstrim_list); in __issue_discard_cmd_range()
3137 mutex_unlock(&dcc->cmd_lock); in __issue_discard_cmd_range()
3153 mutex_unlock(&dcc->cmd_lock); in __issue_discard_cmd_range()