]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: fix iostat parameter for discard
authorYangtao Li <frank.li@vivo.com>
Mon, 5 Dec 2022 14:56:03 +0000 (22:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:26:23 +0000 (13:26 +0100)
[ Upstream commit 15e38ee44d50cad264da80ef75626b9224ddc4a3 ]

Just like other data we count uses the number of bytes as the basic unit,
but discard uses the number of cmds as the statistical unit. In fact the
discard command contains the number of blocks, so let's change to the
number of bytes as the base unit.

Fixes: b0af6d491a6b ("f2fs: add app/fs io stat")
Signed-off-by: Yangtao Li <frank.li@vivo.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/segment.c

index 27690f757913b083b5c50a5dbd2de78d3400a41e..2afed479160b840fc460ca44cde5ae5f5ea37e44 100644 (file)
@@ -1171,7 +1171,7 @@ submit:
 
                atomic_inc(&dcc->issued_discard);
 
-               f2fs_update_iostat(sbi, FS_DISCARD, 1);
+               f2fs_update_iostat(sbi, FS_DISCARD, len * F2FS_BLKSIZE);
 
                lstart += len;
                start += len;