Commit f56aa1c5 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

f2fs: fix to return exact trimmed size



Now, we add all the candidates for trim commands and then finally issue
discard commands.
So, we should count the trimmed size in back-end.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent f62185d0
...@@ -544,7 +544,6 @@ static void __add_discard_entry(struct f2fs_sb_info *sbi, ...@@ -544,7 +544,6 @@ static void __add_discard_entry(struct f2fs_sb_info *sbi,
list_add_tail(&new->list, head); list_add_tail(&new->list, head);
done: done:
SM_I(sbi)->nr_discards += end - start; SM_I(sbi)->nr_discards += end - start;
cpc->trimmed += end - start;
} }
static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc) static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc)
...@@ -646,6 +645,7 @@ void clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc) ...@@ -646,6 +645,7 @@ void clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc)
if (cpc->reason == CP_DISCARD && entry->len < cpc->trim_minlen) if (cpc->reason == CP_DISCARD && entry->len < cpc->trim_minlen)
goto skip; goto skip;
f2fs_issue_discard(sbi, entry->blkaddr, entry->len); f2fs_issue_discard(sbi, entry->blkaddr, entry->len);
cpc->trimmed += entry->len;
skip: skip:
list_del(&entry->list); list_del(&entry->list);
SM_I(sbi)->nr_discards -= entry->len; SM_I(sbi)->nr_discards -= entry->len;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment