Lines Matching full:dcc

953 	struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;  in __create_discard_cmd()  local
959 pend_list = &dcc->pend_list[plist_idx(len)]; in __create_discard_cmd()
975 atomic_inc(&dcc->discard_cmd_cnt); in __create_discard_cmd()
976 dcc->undiscard_blks += len; in __create_discard_cmd()
984 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_check_discard_tree() local
985 struct rb_node *cur = rb_first_cached(&dcc->root), *next; in f2fs_check_discard_tree()
1012 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __lookup_discard_cmd() local
1013 struct rb_node *node = dcc->root.rb_root.rb_node; in __lookup_discard_cmd()
1086 static void __detach_discard_cmd(struct discard_cmd_control *dcc, in __detach_discard_cmd() argument
1090 atomic_sub(dc->queued, &dcc->queued_discard); in __detach_discard_cmd()
1093 rb_erase_cached(&dc->rb_node, &dcc->root); in __detach_discard_cmd()
1094 dcc->undiscard_blks -= dc->di.len; in __detach_discard_cmd()
1098 atomic_dec(&dcc->discard_cmd_cnt); in __detach_discard_cmd()
1104 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __remove_discard_cmd() local
1125 __detach_discard_cmd(dcc, dc); in __remove_discard_cmd()
1175 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __init_discard_policy() local
1183 dpolicy->max_requests = dcc->max_discard_request; in __init_discard_policy()
1184 dpolicy->io_aware_gran = dcc->discard_io_aware_gran; in __init_discard_policy()
1188 dpolicy->min_interval = dcc->min_discard_issue_time; in __init_discard_policy()
1189 dpolicy->mid_interval = dcc->mid_discard_issue_time; in __init_discard_policy()
1190 dpolicy->max_interval = dcc->max_discard_issue_time; in __init_discard_policy()
1191 if (dcc->discard_io_aware == DPOLICY_IO_AWARE_ENABLE) in __init_discard_policy()
1193 else if (dcc->discard_io_aware == DPOLICY_IO_AWARE_DISABLE) in __init_discard_policy()
1197 if (utilization(sbi) > dcc->discard_urgent_util) { in __init_discard_policy()
1199 if (atomic_read(&dcc->discard_cmd_cnt)) in __init_discard_policy()
1201 dcc->min_discard_issue_time; in __init_discard_policy()
1204 dpolicy->min_interval = dcc->min_discard_issue_time; in __init_discard_policy()
1205 dpolicy->mid_interval = dcc->mid_discard_issue_time; in __init_discard_policy()
1206 dpolicy->max_interval = dcc->max_discard_issue_time; in __init_discard_policy()
1228 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __submit_zone_reset_cmd() local
1243 atomic_inc(&dcc->queued_discard); in __submit_zone_reset_cmd()
1255 atomic_inc(&dcc->issued_discard); in __submit_zone_reset_cmd()
1268 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __submit_discard_cmd() local
1270 &(dcc->fstrim_list) : &(dcc->wait_list); in __submit_discard_cmd()
1359 atomic_inc(&dcc->queued_discard); in __submit_discard_cmd()
1371 atomic_inc(&dcc->issued_discard); in __submit_discard_cmd()
1382 dcc->undiscard_blks -= len; in __submit_discard_cmd()
1392 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __insert_discard_cmd() local
1393 struct rb_node **p = &dcc->root.rb_root.rb_node; in __insert_discard_cmd()
1417 rb_insert_color_cached(&dc->rb_node, &dcc->root, leftmost); in __insert_discard_cmd()
1420 static void __relocate_discard_cmd(struct discard_cmd_control *dcc, in __relocate_discard_cmd() argument
1423 list_move_tail(&dc->list, &dcc->pend_list[plist_idx(dc->di.len)]); in __relocate_discard_cmd()
1429 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __punch_discard_cmd() local
1438 dcc->undiscard_blks -= di.len; in __punch_discard_cmd()
1442 dcc->undiscard_blks += dc->di.len; in __punch_discard_cmd()
1443 __relocate_discard_cmd(dcc, dc); in __punch_discard_cmd()
1456 dcc->undiscard_blks += dc->di.len; in __punch_discard_cmd()
1457 __relocate_discard_cmd(dcc, dc); in __punch_discard_cmd()
1466 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __update_discard_tree_range() local
1475 dc = __lookup_discard_cmd_ret(&dcc->root, lstart, in __update_discard_tree_range()
1514 dcc->undiscard_blks += di.len; in __update_discard_tree_range()
1515 __relocate_discard_cmd(dcc, prev_dc); in __update_discard_tree_range()
1528 dcc->undiscard_blks += di.len; in __update_discard_tree_range()
1529 __relocate_discard_cmd(dcc, next_dc); in __update_discard_tree_range()
1584 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __issue_discard_cmd_orderly() local
1591 mutex_lock(&dcc->cmd_lock); in __issue_discard_cmd_orderly()
1592 dc = __lookup_discard_cmd_ret(&dcc->root, dcc->next_pos, in __issue_discard_cmd_orderly()
1611 dcc->next_pos = dc->di.lstart + dc->di.len; in __issue_discard_cmd_orderly()
1626 dcc->next_pos = 0; in __issue_discard_cmd_orderly()
1628 mutex_unlock(&dcc->cmd_lock); in __issue_discard_cmd_orderly()
1639 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __issue_discard_cmd() local
1659 if (i + 1 < dcc->max_ordered_discard && dpolicy->ordered) { in __issue_discard_cmd()
1664 pend_list = &dcc->pend_list[i]; in __issue_discard_cmd()
1666 mutex_lock(&dcc->cmd_lock); in __issue_discard_cmd()
1669 if (unlikely(dcc->rbtree_check)) in __issue_discard_cmd()
1692 mutex_unlock(&dcc->cmd_lock); in __issue_discard_cmd()
1711 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __drop_discard_cmd() local
1717 mutex_lock(&dcc->cmd_lock); in __drop_discard_cmd()
1719 pend_list = &dcc->pend_list[i]; in __drop_discard_cmd()
1726 mutex_unlock(&dcc->cmd_lock); in __drop_discard_cmd()
1739 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __wait_one_discard_bio() local
1743 mutex_lock(&dcc->cmd_lock); in __wait_one_discard_bio()
1751 mutex_unlock(&dcc->cmd_lock); in __wait_one_discard_bio()
1760 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __wait_discard_cmd_range() local
1762 &(dcc->fstrim_list) : &(dcc->wait_list); in __wait_discard_cmd_range()
1769 mutex_lock(&dcc->cmd_lock); in __wait_discard_cmd_range()
1787 mutex_unlock(&dcc->cmd_lock); in __wait_discard_cmd_range()
1818 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_wait_discard_bio() local
1822 mutex_lock(&dcc->cmd_lock); in f2fs_wait_discard_bio()
1829 mutex_unlock(&dcc->cmd_lock); in f2fs_wait_discard_bio()
1837 &dcc->wait_list, NULL); in f2fs_wait_discard_bio()
1839 mutex_unlock(&dcc->cmd_lock); in f2fs_wait_discard_bio()
1854 mutex_unlock(&dcc->cmd_lock); in f2fs_wait_discard_bio()
1862 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_stop_discard_thread() local
1864 if (dcc && dcc->f2fs_issue_discard) { in f2fs_stop_discard_thread()
1865 struct task_struct *discard_thread = dcc->f2fs_issue_discard; in f2fs_stop_discard_thread()
1867 dcc->f2fs_issue_discard = NULL; in f2fs_stop_discard_thread()
1882 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_issue_discard_timeout() local
1886 if (!atomic_read(&dcc->discard_cmd_cnt)) in f2fs_issue_discard_timeout()
1890 dcc->discard_granularity); in f2fs_issue_discard_timeout()
1897 f2fs_bug_on(sbi, atomic_read(&dcc->discard_cmd_cnt)); in f2fs_issue_discard_timeout()
1904 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in issue_discard_thread() local
1905 wait_queue_head_t *q = &dcc->discard_wait_queue; in issue_discard_thread()
1907 unsigned int wait_ms = dcc->min_discard_issue_time; in issue_discard_thread()
1914 kthread_should_stop() || dcc->discard_wake, in issue_discard_thread()
1923 dcc->discard_granularity); in issue_discard_thread()
1925 if (dcc->discard_wake) in issue_discard_thread()
1926 dcc->discard_wake = false; in issue_discard_thread()
1929 if (atomic_read(&dcc->queued_discard)) in issue_discard_thread()
1937 !atomic_read(&dcc->discard_cmd_cnt)) { in issue_discard_thread()
1955 if (!atomic_read(&dcc->discard_cmd_cnt)) in issue_discard_thread()
2165 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_clear_prefree_segments() local
2166 struct list_head *head = &dcc->entry_list; in f2fs_clear_prefree_segments()
2265 dcc->nr_discards -= total_len; in f2fs_clear_prefree_segments()
2275 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_start_discard_thread() local
2287 dcc->f2fs_issue_discard = kthread_run(issue_discard_thread, sbi, in f2fs_start_discard_thread()
2289 if (IS_ERR(dcc->f2fs_issue_discard)) { in f2fs_start_discard_thread()
2290 err = PTR_ERR(dcc->f2fs_issue_discard); in f2fs_start_discard_thread()
2291 dcc->f2fs_issue_discard = NULL; in f2fs_start_discard_thread()
2299 struct discard_cmd_control *dcc; in create_discard_cmd_control() local
2303 dcc = SM_I(sbi)->dcc_info; in create_discard_cmd_control()
2307 dcc = f2fs_kzalloc(sbi, sizeof(struct discard_cmd_control), GFP_KERNEL); in create_discard_cmd_control()
2308 if (!dcc) in create_discard_cmd_control()
2311 dcc->discard_io_aware_gran = MAX_PLIST_NUM; in create_discard_cmd_control()
2312 dcc->discard_granularity = DEFAULT_DISCARD_GRANULARITY; in create_discard_cmd_control()
2313 dcc->max_ordered_discard = DEFAULT_MAX_ORDERED_DISCARD_GRANULARITY; in create_discard_cmd_control()
2314 dcc->discard_io_aware = DPOLICY_IO_AWARE_ENABLE; in create_discard_cmd_control()
2316 dcc->discard_granularity = BLKS_PER_SEG(sbi); in create_discard_cmd_control()
2318 dcc->discard_granularity = BLKS_PER_SEC(sbi); in create_discard_cmd_control()
2320 INIT_LIST_HEAD(&dcc->entry_list); in create_discard_cmd_control()
2322 INIT_LIST_HEAD(&dcc->pend_list[i]); in create_discard_cmd_control()
2323 INIT_LIST_HEAD(&dcc->wait_list); in create_discard_cmd_control()
2324 INIT_LIST_HEAD(&dcc->fstrim_list); in create_discard_cmd_control()
2325 mutex_init(&dcc->cmd_lock); in create_discard_cmd_control()
2326 atomic_set(&dcc->issued_discard, 0); in create_discard_cmd_control()
2327 atomic_set(&dcc->queued_discard, 0); in create_discard_cmd_control()
2328 atomic_set(&dcc->discard_cmd_cnt, 0); in create_discard_cmd_control()
2329 dcc->nr_discards = 0; in create_discard_cmd_control()
2330 dcc->max_discards = SEGS_TO_BLKS(sbi, MAIN_SEGS(sbi)); in create_discard_cmd_control()
2331 dcc->max_discard_request = DEF_MAX_DISCARD_REQUEST; in create_discard_cmd_control()
2332 dcc->min_discard_issue_time = DEF_MIN_DISCARD_ISSUE_TIME; in create_discard_cmd_control()
2333 dcc->mid_discard_issue_time = DEF_MID_DISCARD_ISSUE_TIME; in create_discard_cmd_control()
2334 dcc->max_discard_issue_time = DEF_MAX_DISCARD_ISSUE_TIME; in create_discard_cmd_control()
2335 dcc->discard_urgent_util = DEF_DISCARD_URGENT_UTIL; in create_discard_cmd_control()
2336 dcc->undiscard_blks = 0; in create_discard_cmd_control()
2337 dcc->next_pos = 0; in create_discard_cmd_control()
2338 dcc->root = RB_ROOT_CACHED; in create_discard_cmd_control()
2339 dcc->rbtree_check = false; in create_discard_cmd_control()
2341 init_waitqueue_head(&dcc->discard_wait_queue); in create_discard_cmd_control()
2342 SM_I(sbi)->dcc_info = dcc; in create_discard_cmd_control()
2346 kfree(dcc); in create_discard_cmd_control()
2355 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in destroy_discard_cmd_control() local
2357 if (!dcc) in destroy_discard_cmd_control()
2368 kfree(dcc); in destroy_discard_cmd_control()
3289 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __issue_discard_cmd_range() local
3300 mutex_lock(&dcc->cmd_lock); in __issue_discard_cmd_range()
3301 if (unlikely(dcc->rbtree_check)) in __issue_discard_cmd_range()
3304 dc = __lookup_discard_cmd_ret(&dcc->root, start, in __issue_discard_cmd_range()
3319 list_move_tail(&dc->list, &dcc->fstrim_list); in __issue_discard_cmd_range()
3332 mutex_unlock(&dcc->cmd_lock); in __issue_discard_cmd_range()
3348 mutex_unlock(&dcc->cmd_lock); in __issue_discard_cmd_range()