Lines Matching refs:dcc
809 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __create_discard_cmd() local
815 pend_list = &dcc->pend_list[plist_idx(len)]; in __create_discard_cmd()
828 atomic_inc(&dcc->discard_cmd_cnt); in __create_discard_cmd()
829 dcc->undiscard_blks += len; in __create_discard_cmd()
839 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __attach_discard_cmd() local
845 rb_insert_color(&dc->rb_node, &dcc->root); in __attach_discard_cmd()
850 static void __detach_discard_cmd(struct discard_cmd_control *dcc, in __detach_discard_cmd() argument
854 atomic_dec(&dcc->issing_discard); in __detach_discard_cmd()
857 rb_erase(&dc->rb_node, &dcc->root); in __detach_discard_cmd()
858 dcc->undiscard_blks -= dc->len; in __detach_discard_cmd()
862 atomic_dec(&dcc->discard_cmd_cnt); in __detach_discard_cmd()
868 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __remove_discard_cmd() local
881 __detach_discard_cmd(dcc, dc); in __remove_discard_cmd()
1040 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __submit_discard_cmd() local
1042 &(dcc->fstrim_list) : &(dcc->wait_list); in __submit_discard_cmd()
1058 atomic_inc(&dcc->issued_discard); in __submit_discard_cmd()
1059 atomic_inc(&dcc->issing_discard); in __submit_discard_cmd()
1080 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __insert_discard_tree() local
1091 p = __lookup_rb_tree_for_insert(sbi, &dcc->root, &parent, lstart); in __insert_discard_tree()
1100 static void __relocate_discard_cmd(struct discard_cmd_control *dcc, in __relocate_discard_cmd() argument
1103 list_move_tail(&dc->list, &dcc->pend_list[plist_idx(dc->len)]); in __relocate_discard_cmd()
1109 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __punch_discard_cmd() local
1118 dcc->undiscard_blks -= di.len; in __punch_discard_cmd()
1122 dcc->undiscard_blks += dc->len; in __punch_discard_cmd()
1123 __relocate_discard_cmd(dcc, dc); in __punch_discard_cmd()
1137 dcc->undiscard_blks += dc->len; in __punch_discard_cmd()
1138 __relocate_discard_cmd(dcc, dc); in __punch_discard_cmd()
1147 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __update_discard_tree_range() local
1154 mutex_lock(&dcc->cmd_lock); in __update_discard_tree_range()
1156 dc = (struct discard_cmd *)__lookup_rb_tree_ret(&dcc->root, in __update_discard_tree_range()
1197 dcc->undiscard_blks += di.len; in __update_discard_tree_range()
1198 __relocate_discard_cmd(dcc, prev_dc); in __update_discard_tree_range()
1210 dcc->undiscard_blks += di.len; in __update_discard_tree_range()
1211 __relocate_discard_cmd(dcc, next_dc); in __update_discard_tree_range()
1230 mutex_unlock(&dcc->cmd_lock); in __update_discard_tree_range()
1252 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __issue_discard_cmd() local
1262 pend_list = &dcc->pend_list[i]; in __issue_discard_cmd()
1264 mutex_lock(&dcc->cmd_lock); in __issue_discard_cmd()
1267 f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root)); in __issue_discard_cmd()
1286 mutex_unlock(&dcc->cmd_lock); in __issue_discard_cmd()
1300 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __drop_discard_cmd() local
1306 mutex_lock(&dcc->cmd_lock); in __drop_discard_cmd()
1308 pend_list = &dcc->pend_list[i]; in __drop_discard_cmd()
1315 mutex_unlock(&dcc->cmd_lock); in __drop_discard_cmd()
1328 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __wait_one_discard_bio() local
1332 mutex_lock(&dcc->cmd_lock); in __wait_one_discard_bio()
1340 mutex_unlock(&dcc->cmd_lock); in __wait_one_discard_bio()
1349 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __wait_discard_cmd_range() local
1351 &(dcc->fstrim_list) : &(dcc->wait_list); in __wait_discard_cmd_range()
1359 mutex_lock(&dcc->cmd_lock); in __wait_discard_cmd_range()
1376 mutex_unlock(&dcc->cmd_lock); in __wait_discard_cmd_range()
1406 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_wait_discard_bio() local
1410 mutex_lock(&dcc->cmd_lock); in f2fs_wait_discard_bio()
1411 dc = (struct discard_cmd *)__lookup_rb_tree(&dcc->root, NULL, blkaddr); in f2fs_wait_discard_bio()
1420 mutex_unlock(&dcc->cmd_lock); in f2fs_wait_discard_bio()
1428 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in stop_discard_thread() local
1430 if (dcc && dcc->f2fs_issue_discard) { in stop_discard_thread()
1431 struct task_struct *discard_thread = dcc->f2fs_issue_discard; in stop_discard_thread()
1433 dcc->f2fs_issue_discard = NULL; in stop_discard_thread()
1441 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in f2fs_wait_discard_bios() local
1446 dcc->discard_granularity); in f2fs_wait_discard_bios()
1458 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in issue_discard_thread() local
1459 wait_queue_head_t *q = &dcc->discard_wait_queue; in issue_discard_thread()
1468 dcc->discard_granularity); in issue_discard_thread()
1472 dcc->discard_wake, in issue_discard_thread()
1481 if (dcc->discard_wake) in issue_discard_thread()
1482 dcc->discard_wake = 0; in issue_discard_thread()
1689 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in clear_prefree_segments() local
1690 struct list_head *head = &dcc->entry_list; in clear_prefree_segments()
1771 dcc->nr_discards -= total_len; in clear_prefree_segments()
1781 struct discard_cmd_control *dcc; in create_discard_cmd_control() local
1785 dcc = SM_I(sbi)->dcc_info; in create_discard_cmd_control()
1789 dcc = f2fs_kzalloc(sbi, sizeof(struct discard_cmd_control), GFP_KERNEL); in create_discard_cmd_control()
1790 if (!dcc) in create_discard_cmd_control()
1793 dcc->discard_granularity = DEFAULT_DISCARD_GRANULARITY; in create_discard_cmd_control()
1794 INIT_LIST_HEAD(&dcc->entry_list); in create_discard_cmd_control()
1796 INIT_LIST_HEAD(&dcc->pend_list[i]); in create_discard_cmd_control()
1797 INIT_LIST_HEAD(&dcc->wait_list); in create_discard_cmd_control()
1798 INIT_LIST_HEAD(&dcc->fstrim_list); in create_discard_cmd_control()
1799 mutex_init(&dcc->cmd_lock); in create_discard_cmd_control()
1800 atomic_set(&dcc->issued_discard, 0); in create_discard_cmd_control()
1801 atomic_set(&dcc->issing_discard, 0); in create_discard_cmd_control()
1802 atomic_set(&dcc->discard_cmd_cnt, 0); in create_discard_cmd_control()
1803 dcc->nr_discards = 0; in create_discard_cmd_control()
1804 dcc->max_discards = MAIN_SEGS(sbi) << sbi->log_blocks_per_seg; in create_discard_cmd_control()
1805 dcc->undiscard_blks = 0; in create_discard_cmd_control()
1806 dcc->root = RB_ROOT; in create_discard_cmd_control()
1808 init_waitqueue_head(&dcc->discard_wait_queue); in create_discard_cmd_control()
1809 SM_I(sbi)->dcc_info = dcc; in create_discard_cmd_control()
1811 dcc->f2fs_issue_discard = kthread_run(issue_discard_thread, sbi, in create_discard_cmd_control()
1813 if (IS_ERR(dcc->f2fs_issue_discard)) { in create_discard_cmd_control()
1814 err = PTR_ERR(dcc->f2fs_issue_discard); in create_discard_cmd_control()
1815 kfree(dcc); in create_discard_cmd_control()
1825 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in destroy_discard_cmd_control() local
1827 if (!dcc) in destroy_discard_cmd_control()
1832 kfree(dcc); in destroy_discard_cmd_control()
2421 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in __issue_discard_cmd_range() local
2431 mutex_lock(&dcc->cmd_lock); in __issue_discard_cmd_range()
2432 f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root)); in __issue_discard_cmd_range()
2434 dc = (struct discard_cmd *)__lookup_rb_tree_ret(&dcc->root, in __issue_discard_cmd_range()
2451 list_move_tail(&dc->list, &dcc->fstrim_list); in __issue_discard_cmd_range()
2461 mutex_unlock(&dcc->cmd_lock); in __issue_discard_cmd_range()
2475 mutex_unlock(&dcc->cmd_lock); in __issue_discard_cmd_range()