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@xxxxxx> Heh, whoops. Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> --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 > >