summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-06-03 00:48:20 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2015-06-03 00:48:20 +0200
commitf56aa1c57ea921e45bb6cf5d83a04cbc8f38fae5 (patch)
treef3305833a495bda3db450441f7da855bb9bfcf6d /fs/f2fs
parentf2fs: support FALLOC_FL_INSERT_RANGE (diff)
downloadlinux-f56aa1c57ea921e45bb6cf5d83a04cbc8f38fae5.tar.xz
linux-f56aa1c57ea921e45bb6cf5d83a04cbc8f38fae5.zip
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: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/segment.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 46283a153acf..1eb343768781 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -544,7 +544,6 @@ static void __add_discard_entry(struct f2fs_sb_info *sbi,
list_add_tail(&new->list, head);
done:
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)
@@ -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)
goto skip;
f2fs_issue_discard(sbi, entry->blkaddr, entry->len);
+ cpc->trimmed += entry->len;
skip:
list_del(&entry->list);
SM_I(sbi)->nr_discards -= entry->len;