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


Groups > linux.kernel > #1434373

[PATCH 1/2] f2fs: fix to return correct trimmed block number in FITRIM interface

From Chao Yu <yuchao0@huawei.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] f2fs: fix to return correct trimmed block number in FITRIM interface
Date 2016-06-30 10:50 +0200
Message-ID <rPFPz-7mK-13@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


During tiggering fstrim, in case of issuing discard for prefree segments,
we miss acclumulating trimmed block number which will be return to user.
Fix it.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/segment.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 6d16ecf..5dc14d6 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -732,15 +732,20 @@ void clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 		if (!test_opt(sbi, LFS) || sbi->segs_per_sec == 1) {
 			f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
 				(end - start) << sbi->log_blocks_per_seg);
+			cpc->trimmed +=
+				(end - start) << sbi->log_blocks_per_seg;
 			continue;
 		}
 next:
 		secno = GET_SECNO(sbi, start);
 		start_segno = secno * sbi->segs_per_sec;
 		if (!IS_CURSEC(sbi, secno) &&
-			!get_valid_blocks(sbi, start, sbi->segs_per_sec))
+			!get_valid_blocks(sbi, start, sbi->segs_per_sec)) {
 			f2fs_issue_discard(sbi, START_BLOCK(sbi, start_segno),
 				sbi->segs_per_sec << sbi->log_blocks_per_seg);
+			cpc->trimmed +=
+				sbi->segs_per_sec << sbi->log_blocks_per_seg;
+		}
 
 		start = start_segno + sbi->segs_per_sec;
 		if (start < end)
-- 
2.8.2.311.gee88674

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


Thread

[PATCH 1/2] f2fs: fix to return correct trimmed block number in FITRIM interface Chao Yu <yuchao0@huawei.com> - 2016-06-30 10:50 +0200
  [PATCH 2/2] f2fs: fix to avoid data update racing between GC and DIO Chao Yu <yuchao0@huawei.com> - 2016-06-30 10:50 +0200
    Re: [PATCH 2/2] f2fs: fix to avoid data update racing between GC and  DIO Jaegeuk Kim <jaegeuk@kernel.org> - 2016-07-01 02:10 +0200
      Re: [PATCH 2/2] f2fs: fix to avoid data update racing between GC and  DIO Chao Yu <yuchao0@huawei.com> - 2016-07-01 08:10 +0200
        Re: [PATCH 2/2] f2fs: fix to avoid data update racing between GC and  DIO Jaegeuk Kim <jaegeuk@kernel.org> - 2016-07-06 02:30 +0200
          Re: [PATCH 2/2] f2fs: fix to avoid data update racing between GC and  DIO Chao Yu <yuchao0@huawei.com> - 2016-07-06 04:20 +0200
            Re: [PATCH 2/2] f2fs: fix to avoid data update racing between GC and  DIO Jaegeuk Kim <jaegeuk@kernel.org> - 2016-07-07 00:40 +0200
              Re: [f2fs-dev] [PATCH 2/2] f2fs: fix to avoid data update racing  between GC and DIO Chao Yu <chao@kernel.org> - 2016-07-07 06:30 +0200
  Re: [f2fs-dev] [PATCH 1/2] f2fs: fix to return correct trimmed block  number in FITRIM interface Chao Yu <chao@kernel.org> - 2016-07-07 06:30 +0200

csiph-web