This patch adds to account undiscard blocks.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
atomic_read(&SM_I(sbi)->dcc_info->issing_discard);
si->nr_discard_cmd =
atomic_read(&SM_I(sbi)->dcc_info->discard_cmd_cnt);
+ si->undiscard_blks = SM_I(sbi)->dcc_info->undiscard_blks;
}
si->total_count = (int)sbi->user_block_count / sbi->blocks_per_seg;
si->rsvd_segs = reserved_segments(sbi);
si->ext_tree, si->zombie_tree, si->ext_node);
seq_puts(s, "\nBalancing F2FS Async:\n");
seq_printf(s, " - IO (CP: %4d, Data: %4d, Flush: (%4d %4d), "
- "Discard: (%4d %4d)) cmd: %4d\n",
+ "Discard: (%4d %4d)) cmd: %4d undiscard:%4u\n",
si->nr_wb_cp_data, si->nr_wb_data,
si->nr_flushing, si->nr_flushed,
si->nr_discarding, si->nr_discarded,
- si->nr_discard_cmd);
+ si->nr_discard_cmd, si->undiscard_blks);
seq_printf(s, " - inmem: %4d, atomic IO: %4d (Max. %4d), "
"volatile IO: %4d (Max. %4d)\n",
si->inmem_pages, si->aw_cnt, si->max_aw_cnt,
struct mutex cmd_lock;
int nr_discards; /* # of discards in the list */
int max_discards; /* max. discards to be issued */
+ unsigned int undiscard_blks; /* # of undiscard blocks */
atomic_t issued_discard; /* # of issued discard */
atomic_t issing_discard; /* # of issing discard */
atomic_t discard_cmd_cnt; /* # of cached cmd count */
int bg_gc, nr_wb_cp_data, nr_wb_data;
int nr_flushing, nr_flushed, nr_discarding, nr_discarded;
int nr_discard_cmd;
+ unsigned int undiscard_blks;
int inline_xattr, inline_inode, inline_dir, append, update, orphans;
int aw_cnt, max_aw_cnt, vw_cnt, max_vw_cnt;
unsigned int valid_count, valid_node_count, valid_inode_count, discard_blks;
init_completion(&dc->wait);
list_add_tail(&dc->list, pend_list);
atomic_inc(&dcc->discard_cmd_cnt);
+ dcc->undiscard_blks += len;
return dc;
}
list_del(&dc->list);
rb_erase(&dc->rb_node, &dcc->root);
+ dcc->undiscard_blks -= dc->len;
kmem_cache_free(discard_cmd_slab, dc);
return;
}
+ dcc->undiscard_blks -= di.len;
+
if (blkaddr > di.lstart) {
dc->len = blkaddr - dc->lstart;
+ dcc->undiscard_blks += dc->len;
__relocate_discard_cmd(dcc, dc);
f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
modified = true;
dc->lstart++;
dc->len--;
dc->start++;
+ dcc->undiscard_blks += dc->len;
__relocate_discard_cmd(dcc, dc);
f2fs_bug_on(sbi,
!__check_rb_tree_consistence(sbi, &dcc->root));
prev_dc->bdev == bdev &&
__is_discard_back_mergeable(&di, &prev_dc->di)) {
prev_dc->di.len += di.len;
+ dcc->undiscard_blks += di.len;
__relocate_discard_cmd(dcc, prev_dc);
f2fs_bug_on(sbi,
!__check_rb_tree_consistence(sbi, &dcc->root));
next_dc->di.lstart = di.lstart;
next_dc->di.len += di.len;
next_dc->di.start = di.start;
+ dcc->undiscard_blks += di.len;
__relocate_discard_cmd(dcc, next_dc);
if (tdc)
__remove_discard_cmd(sbi, tdc);
atomic_set(&dcc->discard_cmd_cnt, 0);
dcc->nr_discards = 0;
dcc->max_discards = 0;
+ dcc->undiscard_blks = 0;
dcc->root = RB_ROOT;
init_waitqueue_head(&dcc->discard_wait_queue);