ocfs2: correct range->len in ocfs2_trim_fs()
authorYuanheng Zhang <yuanhengzhang1214@gmail.com>
Mon, 28 Aug 2023 05:17:41 +0000 (13:17 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 4 Oct 2023 17:41:56 +0000 (10:41 -0700)
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 <yuanhengzhang1214@gmail.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/alloc.c

index aef58f1395c870cc9eaf3fcaeb053e4438d2e787..0fb5e3a875d2f9860db4543494b7f0001476156f 100644 (file)
@@ -7642,7 +7642,7 @@ out_mutex:
                goto next_group;
        }
 out:
-       range->len = trimmed * sb->s_blocksize;
+       range->len = trimmed * osb->s_clustersize;
        return ret;
 }