Commit 9d069603 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Chandan Babu R

xfs: don't open code XFS_FILBLKS_MIN in xfs_bmapi_write

XFS_FILBLKS_MIN uses min_t and thus does the comparison using the correct
xfs_filblks_t type.  Use it in xfs_bmapi_write and slightly adjust the
comment document th potential pitfall to take account of this
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
parent 04c609e6
...@@ -4528,14 +4528,11 @@ xfs_bmapi_write( ...@@ -4528,14 +4528,11 @@ xfs_bmapi_write(
* allocation length request (which can be 64 bits in * allocation length request (which can be 64 bits in
* length) and the bma length request, which is * length) and the bma length request, which is
* xfs_extlen_t and therefore 32 bits. Hence we have to * xfs_extlen_t and therefore 32 bits. Hence we have to
* check for 32-bit overflows and handle them here. * be careful and do the min() using the larger type to
* avoid overflows.
*/ */
if (len > (xfs_filblks_t)XFS_MAX_BMBT_EXTLEN) bma.length = XFS_FILBLKS_MIN(len, XFS_MAX_BMBT_EXTLEN);
bma.length = XFS_MAX_BMBT_EXTLEN;
else
bma.length = len;
ASSERT(len > 0);
ASSERT(bma.length > 0); ASSERT(bma.length > 0);
error = xfs_bmapi_allocate(&bma); error = xfs_bmapi_allocate(&bma);
if (error) { if (error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment