xfs: fix units conversion error in xfs_bmap_del_extent_delay
authorDarrick J. Wong <djwong@kernel.org>
Thu, 8 Feb 2024 23:20:39 +0000 (15:20 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Feb 2024 18:10:44 +0000 (19:10 +0100)
commite3aca4536b6b0d4a8ecf8c2066180ad87048236b
tree84c9281c5954e8a12bfe9858bc6bbd221e55c348
parentfe327b8234d49265ecfeeb1bdd30cb4caa0d1d30
xfs: fix units conversion error in xfs_bmap_del_extent_delay

commit ddd98076d5c075c8a6c49d9e6e8ee12844137f23 upstream.

The unit conversions in this function do not make sense.  First we
convert a block count to bytes, then divide that bytes value by
rextsize, which is in blocks, to get an rt extent count.  You can't
divide bytes by blocks to get a (possibly multiblock) extent value.

Fortunately nobody uses delalloc on the rt volume so this hasn't
mattered.

Fixes: fa5c836ca8eb5 ("xfs: refactor xfs_bunmapi_cow")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/xfs/libxfs/xfs_bmap.c