From: Sahitya Tummala Date: Thu, 16 Apr 2020 06:17:41 +0000 (+0530) Subject: f2fs: Fix the accounting of dcc->undiscard_blks X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~1966^2~45 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=df423399757531c20d495bf6b8b83a8dcca3565c;p=linux.git f2fs: Fix the accounting of dcc->undiscard_blks 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 Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 728ff6e316ac..1c48ec866b8c 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1214,8 +1214,10 @@ submit: len = total_len; } - if (!err && len) + if (!err && len) { + dcc->undiscard_blks -= len; __update_discard_tree_range(sbi, bdev, lstart, start, len); + } return err; }