[PATCH] xfs: remove the redundant check in xfs_bmap_first_unused

From: Stephen Zhang
Date: Thu Sep 08 2022 - 23:11:56 EST


Given that
max >= lowest,
hence if
got.br_startoff >= max + len,
then, at the same time,
got.br_startoff >= lowest + len,

So the check here is redundant, remove it.

Signed-off-by: Shida Zhang <zhangshida@xxxxxxxxxx>
---
fs/xfs/libxfs/xfs_bmap.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index e56723dc9cd5..f8a984c41b01 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -1230,8 +1230,7 @@ xfs_bmap_first_unused(
/*
* See if the hole before this extent will work.
*/
- if (got.br_startoff >= lowest + len &&
- got.br_startoff - max >= len)
+ if (got.br_startoff - max >= len)
break;
lastaddr = got.br_startoff + got.br_blockcount;
max = XFS_FILEOFF_MAX(lastaddr, lowest);
--
2.25.1