Re: [PATCH 2/2] ext4: align preallocation size to stripe width
From: David Laight
Date: Thu Apr 09 2026 - 15:01:20 EST
On Thu, 9 Apr 2026 10:29:11 -0400
"Theodore Tso" <tytso@xxxxxxx> wrote:
> On Mon, Dec 08, 2025 at 04:32:46PM +0800, Yu Kuai wrote:
> > When stripe width (io_opt) is configured, align the predicted
> > preallocation size to stripe boundaries. This ensures optimal I/O
> > performance on RAID and other striped storage devices by avoiding
> > partial stripe operations.
> >
> > The current implementation uses hardcoded size predictions (16KB, 32KB,
> > 64KB, etc.) that are not stripe-aware. This causes physical block
> > offsets on disk to be misaligned to stripe boundaries, leading to
> > read-modify-write penalties on RAID arrays and reduced performance.
> >
> > This patch makes size prediction stripe-aware by using multiples of
> > stripe size (1x, 2x, 4x, 8x, 16x, 32x) when s_stripe is set.
> > Additionally, the start offset is aligned to stripe boundaries using
> > rounddown(), which works correctly for both power-of-2 and non-power-of-2
> > stripe sizes. For devices without stripe configuration, the original
> > behavior is preserved.
> > ...
>
> Hi Yu,
>
> Did you see the build failures reported by the kernel build bot on the
> i386[1] and arm[2] platforms? The problem appears to be using
> roundup() and rounddown() on an unsigned long types.
Looks like that whole condition chain should be replaced with something
based on ilog2() (or some other bit-scan function).
David
>
> [1] https://lore.kernel.org/r/202512102331.yweFnVTU-lkp@xxxxxxxxx
> [2] https://lore.kernel.org/r/202512120613.mM5COVWV-lkp@xxxxxxxxx
>
> We can't apply your patch until this issue is addressed.
>
> Thanks,
>
> - Ted
>