linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: Fix the accounting of dcc->undiscard_blks
@ 2020-04-16  6:17 Sahitya Tummala
  2020-04-16  7:27 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Sahitya Tummala @ 2020-04-16  6:17 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel; +Cc: Sahitya Tummala, linux-kernel

When a discard_cmd needs to be split due to dpolicy->max_requests, then
for the remaining length it will be either merged into another cmd or a
new discard_cmd will be created. In this case, there is double
accounting of dcc->undiscard_blks for the remaining len, due to which
it shows incorrect value in stats.

Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
---
 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 728ff6e..1c48ec8 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1214,8 +1214,10 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
 		len = total_len;
 	}
 
-	if (!err && len)
+	if (!err && len) {
+		dcc->undiscard_blks -= len;
 		__update_discard_tree_range(sbi, bdev, lstart, start, len);
+	}
 	return err;
 }
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] f2fs: Fix the accounting of dcc->undiscard_blks
  2020-04-16  6:17 [PATCH] f2fs: Fix the accounting of dcc->undiscard_blks Sahitya Tummala
@ 2020-04-16  7:27 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2020-04-16  7:27 UTC (permalink / raw)
  To: Sahitya Tummala, Jaegeuk Kim, linux-f2fs-devel; +Cc: linux-kernel

On 2020/4/16 14:17, Sahitya Tummala wrote:
> When a discard_cmd needs to be split due to dpolicy->max_requests, then
> for the remaining length it will be either merged into another cmd or a
> new discard_cmd will be created. In this case, there is double
> accounting of dcc->undiscard_blks for the remaining len, due to which
> it shows incorrect value in stats.
> 
> Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-16  7:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16  6:17 [PATCH] f2fs: Fix the accounting of dcc->undiscard_blks Sahitya Tummala
2020-04-16  7:27 ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).