diff mbox series

[5/7] rc: fix _get_max_lfs_filesize on 32-bit platforms

Message ID 157915146694.2374854.4708773619544238610.stgit@magnolia
State New, archived
Headers show
Series fstests: random fixes | expand

Commit Message

Darrick J. Wong Jan. 16, 2020, 5:11 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

The 32-bit calculation of the maximum filesize is incorrect.  Replace it
with the formula that the kernel has used since commit 0cc3b0ec23ce
("Clarify (and fix) MAX_LFS_FILESIZE macros").  This fixes a regression
in generic/351 on 32-bit kernels.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig Jan. 16, 2020, 9:25 a.m. UTC | #1
On Wed, Jan 15, 2020 at 09:11:07PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> The 32-bit calculation of the maximum filesize is incorrect.  Replace it
> with the formula that the kernel has used since commit 0cc3b0ec23ce
> ("Clarify (and fix) MAX_LFS_FILESIZE macros").  This fixes a regression
> in generic/351 on 32-bit kernels.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index eeac1355..cf6bc9d5 100644
--- a/common/rc
+++ b/common/rc
@@ -3999,7 +3999,9 @@  _get_max_lfs_filesize()
 {
 	case "$(getconf LONG_BIT)" in
 	"32")
-		echo $(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1))
+		local ulong_max=$(getconf ULONG_MAX)
+		local page_size=$(getconf PAGE_SIZE)
+		echo $(( ulong_max * page_size ))
 		;;
 	"64")
 		echo 9223372036854775807