summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorYunlei He <heyunlei@huawei.com>2016-07-07 12:13:33 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2016-07-08 10:33:33 -0700
commitc7b41e161368388487238d71986a65290f83d74a (patch)
treed5a64c78d1a117fc4dae285df11a77735d118018 /fs/f2fs
parent3e6d0b4d9c1cd3bbe5bacbf9d6de682be2bce8e4 (diff)
downloadlinux-c7b41e161368388487238d71986a65290f83d74a.tar.bz2
f2fs: avoid mismatching block range for discard
This patch skip discard block range smaller than trim_minlen, and can not be merged by neighbour Signed-off-by: Yunlei He <heyunlei@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/segment.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 6d16ecf9d29e..9e13db05e3f0 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -672,6 +672,10 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc)
break;
end = __find_rev_next_zero_bit(dmap, max_blocks, start + 1);
+ if (force && start && end != max_blocks
+ && (end - start) < cpc->trim_minlen)
+ continue;
+
__add_discard_entry(sbi, cpc, se, start, end);
}
}