segment.c (e1da7872f6eda977bd812346bf588c35e4495a1e) segment.c (67fce70ba341f772073cac9c3044aa98c69b24fb)
1/*
2 * fs/f2fs/segment.c
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 1185 unchanged lines hidden (view full) ---

1194 for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
1195 if (i + 1 < dpolicy->granularity)
1196 break;
1197 pend_list = &dcc->pend_list[i];
1198
1199 mutex_lock(&dcc->cmd_lock);
1200 if (list_empty(pend_list))
1201 goto next;
1/*
2 * fs/f2fs/segment.c
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 1185 unchanged lines hidden (view full) ---

1194 for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
1195 if (i + 1 < dpolicy->granularity)
1196 break;
1197 pend_list = &dcc->pend_list[i];
1198
1199 mutex_lock(&dcc->cmd_lock);
1200 if (list_empty(pend_list))
1201 goto next;
1202 f2fs_bug_on(sbi,
1203 !f2fs_check_rb_tree_consistence(sbi, &dcc->root));
1202 if (unlikely(dcc->rbtree_check))
1203 f2fs_bug_on(sbi, !f2fs_check_rb_tree_consistence(sbi,
1204 &dcc->root));
1204 blk_start_plug(&plug);
1205 list_for_each_entry_safe(dc, tmp, pend_list, list) {
1206 f2fs_bug_on(sbi, dc->state != D_PREP);
1207
1208 if (dpolicy->io_aware && i < dpolicy->io_aware_gran &&
1209 !is_idle(sbi)) {
1210 io_interrupted = true;
1211 goto skip;

--- 535 unchanged lines hidden (view full) ---

1747 mutex_init(&dcc->cmd_lock);
1748 atomic_set(&dcc->issued_discard, 0);
1749 atomic_set(&dcc->issing_discard, 0);
1750 atomic_set(&dcc->discard_cmd_cnt, 0);
1751 dcc->nr_discards = 0;
1752 dcc->max_discards = MAIN_SEGS(sbi) << sbi->log_blocks_per_seg;
1753 dcc->undiscard_blks = 0;
1754 dcc->root = RB_ROOT;
1205 blk_start_plug(&plug);
1206 list_for_each_entry_safe(dc, tmp, pend_list, list) {
1207 f2fs_bug_on(sbi, dc->state != D_PREP);
1208
1209 if (dpolicy->io_aware && i < dpolicy->io_aware_gran &&
1210 !is_idle(sbi)) {
1211 io_interrupted = true;
1212 goto skip;

--- 535 unchanged lines hidden (view full) ---

1748 mutex_init(&dcc->cmd_lock);
1749 atomic_set(&dcc->issued_discard, 0);
1750 atomic_set(&dcc->issing_discard, 0);
1751 atomic_set(&dcc->discard_cmd_cnt, 0);
1752 dcc->nr_discards = 0;
1753 dcc->max_discards = MAIN_SEGS(sbi) << sbi->log_blocks_per_seg;
1754 dcc->undiscard_blks = 0;
1755 dcc->root = RB_ROOT;
1756 dcc->rbtree_check = false;
1755
1756 init_waitqueue_head(&dcc->discard_wait_queue);
1757 SM_I(sbi)->dcc_info = dcc;
1758init_thread:
1759 dcc->f2fs_issue_discard = kthread_run(issue_discard_thread, sbi,
1760 "f2fs_discard-%u:%u", MAJOR(dev), MINOR(dev));
1761 if (IS_ERR(dcc->f2fs_issue_discard)) {
1762 err = PTR_ERR(dcc->f2fs_issue_discard);

--- 613 unchanged lines hidden (view full) ---

2376 struct discard_cmd *dc;
2377 struct blk_plug plug;
2378 int issued;
2379
2380next:
2381 issued = 0;
2382
2383 mutex_lock(&dcc->cmd_lock);
1757
1758 init_waitqueue_head(&dcc->discard_wait_queue);
1759 SM_I(sbi)->dcc_info = dcc;
1760init_thread:
1761 dcc->f2fs_issue_discard = kthread_run(issue_discard_thread, sbi,
1762 "f2fs_discard-%u:%u", MAJOR(dev), MINOR(dev));
1763 if (IS_ERR(dcc->f2fs_issue_discard)) {
1764 err = PTR_ERR(dcc->f2fs_issue_discard);

--- 613 unchanged lines hidden (view full) ---

2378 struct discard_cmd *dc;
2379 struct blk_plug plug;
2380 int issued;
2381
2382next:
2383 issued = 0;
2384
2385 mutex_lock(&dcc->cmd_lock);
2384 f2fs_bug_on(sbi, !f2fs_check_rb_tree_consistence(sbi, &dcc->root));
2386 if (unlikely(dcc->rbtree_check))
2387 f2fs_bug_on(sbi, !f2fs_check_rb_tree_consistence(sbi,
2388 &dcc->root));
2385
2386 dc = (struct discard_cmd *)f2fs_lookup_rb_tree_ret(&dcc->root,
2387 NULL, start,
2388 (struct rb_entry **)&prev_dc,
2389 (struct rb_entry **)&next_dc,
2390 &insert_p, &insert_parent, true);
2391 if (!dc)
2392 dc = next_dc;

--- 1723 unchanged lines hidden ---
2389
2390 dc = (struct discard_cmd *)f2fs_lookup_rb_tree_ret(&dcc->root,
2391 NULL, start,
2392 (struct rb_entry **)&prev_dc,
2393 (struct rb_entry **)&next_dc,
2394 &insert_p, &insert_parent, true);
2395 if (!dc)
2396 dc = next_dc;

--- 1723 unchanged lines hidden ---