From: Yuanheng Zhang Date: Mon, 28 Aug 2023 05:17:41 +0000 (+0800) Subject: ocfs2: correct range->len in ocfs2_trim_fs() X-Git-Tag: v6.7-rc1~89^2~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=00adf323b2e7c973a7129b906c381ed377aec1a5;p=thirdparty%2Fkernel%2Flinux.git ocfs2: correct range->len in ocfs2_trim_fs() global bitmap is a cluster allocator,so after we traverse the global bitmap and finished the fstrim,the trimmed range should be 'trimmed * clustersize'.otherwise,the trimmed range printed by 'fstrim -v' is not as expected. Link: https://lkml.kernel.org/r/20230828051741.204577-1-yuanhengzhang1214@gmail.com Signed-off-by: Yuanheng Zhang Reviewed-by: Joseph Qi Cc: Joel Becker Cc: Mark Fasheh Cc: Junxiao Bi Cc: Changwei Ge Cc: Gang He Cc: Jun Piao Signed-off-by: Andrew Morton --- diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index aef58f1395c87..0fb5e3a875d2f 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c @@ -7642,7 +7642,7 @@ out_mutex: goto next_group; } out: - range->len = trimmed * sb->s_blocksize; + range->len = trimmed * osb->s_clustersize; return ret; }