]> www.infradead.org Git - users/hch/xfsprogs.git/commit
xfs: return a 64-bit block count from xfs_btree_count_blocks
authorDarrick J. Wong <djwong@kernel.org>
Thu, 21 Nov 2024 00:24:44 +0000 (16:24 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 28 Nov 2024 02:33:16 +0000 (18:33 -0800)
commit0b18fb010b5806957208f78f226f2b5aca5a8a7c
treeb0a4d96ad4725f6b9956d946c673c94fe8dcbae5
parentf8ab5309cc0cafb1c683383b0d8b2bc06b997c39
xfs: return a 64-bit block count from xfs_btree_count_blocks

With the nrext64 feature enabled, it's possible for a data fork to have
2^48 extent mappings.  Even with a 64k fsblock size, that maps out to
a bmbt containing more than 2^32 blocks.  Therefore, this predicate must
return a u64 count to avoid an integer wraparound that will cause scrub
to do the wrong thing.

It's unlikely that any such filesystem currently exists, because the
incore bmbt would consume more than 64GB of kernel memory on its own,
and so far nobody except me has driven a filesystem that far, judging
from the lack of complaints.

Cc: <stable@vger.kernel.org> # v5.19
Fixes: df9ad5cc7a5240 ("xfs: Introduce macros to represent new maximum extent counts for data/attr forks")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
libxfs/xfs_btree.c
libxfs/xfs_btree.h
libxfs/xfs_ialloc_btree.c