mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ocfs2: correct range->len in ocfs2_trim_fs()
@ 2023-08-28  5:17 Yuanheng Zhang
  2023-08-29  8:27 ` Joseph Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Yuanheng Zhang @ 2023-08-28  5:17 UTC (permalink / raw)
  To: mark; +Cc: jlbec, joseph.qi, ocfs2-devel, linux-kernel, Yuanheng Zhang

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.

Signed-off-by: Yuanheng Zhang <yuanhengzhang1214@gmail.com>
---
 fs/ocfs2/alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 51c93929a146..bced551240cf 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -7642,7 +7642,7 @@ int ocfs2_trim_mainbm(struct super_block *sb, struct fstrim_range *range)
 		goto next_group;
 	}
 out:
-	range->len = trimmed * sb->s_blocksize;
+	range->len = trimmed * osb->s_clustersize;
 	return ret;
 }
 
-- 
2.34.1


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

* Re: [PATCH] ocfs2: correct range->len in ocfs2_trim_fs()
  2023-08-28  5:17 [PATCH] ocfs2: correct range->len in ocfs2_trim_fs() Yuanheng Zhang
@ 2023-08-29  8:27 ` Joseph Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph Qi @ 2023-08-29  8:27 UTC (permalink / raw)
  To: Yuanheng Zhang, mark, akpm; +Cc: jlbec, ocfs2-devel, linux-kernel



On 8/28/23 1:17 PM, Yuanheng Zhang wrote:
> 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.
> 
> Signed-off-by: Yuanheng Zhang <yuanhengzhang1214@gmail.com>

Thanks for pointing this out. It looks fine to me.

Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>

> ---
>  fs/ocfs2/alloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
> index 51c93929a146..bced551240cf 100644
> --- a/fs/ocfs2/alloc.c
> +++ b/fs/ocfs2/alloc.c
> @@ -7642,7 +7642,7 @@ int ocfs2_trim_mainbm(struct super_block *sb, struct fstrim_range *range)
>  		goto next_group;
>  	}
>  out:
> -	range->len = trimmed * sb->s_blocksize;
> +	range->len = trimmed * osb->s_clustersize;
>  	return ret;
>  }
>  

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

end of thread, other threads:[~2023-08-29  8:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28  5:17 [PATCH] ocfs2: correct range->len in ocfs2_trim_fs() Yuanheng Zhang
2023-08-29  8:27 ` Joseph Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®