Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1720658

[PATCH] f2fs: discard small invalid blocks in current active segments

From Yunlong Song <yunlong.song@huawei.com>
Newsgroups linux.kernel
Subject [PATCH] f2fs: discard small invalid blocks in current active segments
Date 2017-08-26 15:00 +0200
Message-ID <uiIQV-1jf-17@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


1. write file A with 5 blocks to current empty active segment
2. remove file A
3. write checkpoint
4. write file B with 507 blocks to the same active segment

If file B is alive all the time, the blocks used by file A will never be
discarded. So current active segment should also be treated as a candidate
for small discards.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 fs/f2fs/segment.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 8375257..a2e7c8f 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1339,7 +1339,9 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc,
 		return false;
 
 	if (!force) {
-		if (!test_opt(sbi, DISCARD) || !se->valid_blocks ||
+		if (!test_opt(sbi, DISCARD) ||
+			(!se->valid_blocks &&
+			!IS_CURSEG(sbi, cpc->trim_start)) ||
 			SM_I(sbi)->dcc_info->nr_discards >=
 				SM_I(sbi)->dcc_info->max_discards)
 			return false;
-- 
1.8.5.2

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] f2fs: discard small invalid blocks in current active segments Yunlong Song <yunlong.song@huawei.com> - 2017-08-26 15:00 +0200
  Re: [PATCH] f2fs: discard small invalid blocks in current active  segments Chao Yu <yuchao0@huawei.com> - 2017-08-28 12:10 +0200
    Re: [PATCH] f2fs: discard small invalid blocks in current active  segments Yunlong Song <yunlong.song@huawei.com> - 2017-08-28 15:30 +0200
      Re: [PATCH] f2fs: discard small invalid blocks in current active  segments Chao Yu <yuchao0@huawei.com> - 2017-08-29 12:10 +0200

csiph-web