diff mbox series

[1/2] xfs: remove a stale comment in xfs_ioc_trim

Message ID 20240814042358.19297-1-hch@lst.de (mailing list archive)
State Superseded, archived
Headers show
Series [1/2] xfs: remove a stale comment in xfs_ioc_trim | expand

Commit Message

Christoph Hellwig Aug. 14, 2024, 4:23 a.m. UTC
There is no truncating down going on here, the code has changed multiple
times since the comment was added with the initial FITRIM implementation
and it doesn't make sense in the current context.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_discard.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Darrick J. Wong Aug. 14, 2024, 5:12 a.m. UTC | #1
On Wed, Aug 14, 2024 at 06:23:57AM +0200, Christoph Hellwig wrote:
> There is no truncating down going on here, the code has changed multiple
> times since the comment was added with the initial FITRIM implementation
> and it doesn't make sense in the current context.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Heh, whoops.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_discard.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
> index 6f0fc7fe1f2ba9..6516afecce0979 100644
> --- a/fs/xfs/xfs_discard.c
> +++ b/fs/xfs/xfs_discard.c
> @@ -689,13 +689,6 @@ xfs_ioc_trim(
>  	range.minlen = max_t(u64, granularity, range.minlen);
>  	minlen = XFS_B_TO_FSB(mp, range.minlen);
>  
> -	/*
> -	 * Truncating down the len isn't actually quite correct, but using
> -	 * BBTOB would mean we trivially get overflows for values
> -	 * of ULLONG_MAX or slightly lower.  And ULLONG_MAX is the default
> -	 * used by the fstrim application.  In the end it really doesn't
> -	 * matter as trimming blocks is an advisory interface.
> -	 */
>  	max_blocks = mp->m_sb.sb_dblocks + mp->m_sb.sb_rblocks;
>  	if (range.start >= XFS_FSB_TO_B(mp, max_blocks) ||
>  	    range.minlen > XFS_FSB_TO_B(mp, mp->m_ag_max_usable) ||
> -- 
> 2.43.0
> 
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
index 6f0fc7fe1f2ba9..6516afecce0979 100644
--- a/fs/xfs/xfs_discard.c
+++ b/fs/xfs/xfs_discard.c
@@ -689,13 +689,6 @@  xfs_ioc_trim(
 	range.minlen = max_t(u64, granularity, range.minlen);
 	minlen = XFS_B_TO_FSB(mp, range.minlen);
 
-	/*
-	 * Truncating down the len isn't actually quite correct, but using
-	 * BBTOB would mean we trivially get overflows for values
-	 * of ULLONG_MAX or slightly lower.  And ULLONG_MAX is the default
-	 * used by the fstrim application.  In the end it really doesn't
-	 * matter as trimming blocks is an advisory interface.
-	 */
 	max_blocks = mp->m_sb.sb_dblocks + mp->m_sb.sb_rblocks;
 	if (range.start >= XFS_FSB_TO_B(mp, max_blocks) ||
 	    range.minlen > XFS_FSB_TO_B(mp, mp->m_ag_max_usable) ||