Re: [PATCH] ext4: fix ext4_tune_sb_params padding

From: Arnd Bergmann

Date: Fri Dec 05 2025 - 06:22:29 EST


On Fri, Dec 5, 2025, at 11:17, Andreas Dilger wrote:
>> On Dec 4, 2025, at 3:31 AM, Jan Kara <jack@xxxxxxx> wrote:
>> On Thu 04-12-25 11:19:10, Arnd Bergmann wrote:
>
> While this change isn't _wrong_ per-se, it does seem very strange to have
> a 68-byte padding at the end of the struct. You have to check the number
> of __u32 fields closely to see this,

I had the same thought but decided against that because it would be
an ABI break on all architectures. The version I posted only changes
the structure size on x86-32, csky, m68k and microblaze, as far
as I can tell.

> and I wonder if this will perpetuate
> errors in the future (e.g. adding a __u64 field after mount_opts[64]).

Indeed, I can see how that could become worse.

> IMHO, it would be more clear to either add an explicit "__u32 pad_3;"
> field after mount_opts[64], or alternately declare mount_opts[68] so it
> will consume those bytes and leave the remaining fields properly aligned.
> It isn't critical if the user tools use the last 4 bytes of mount_opts[]
> or not, so they could be changed independently at some later time.
>
> Either will ensure that new fields added in place of pad[64] will be
> properly aligned in the future.

Changing mount_opts[] to 68 bytes sounds fine to me, I'll send an
updated patch for that. I've kept the Ack from Jan, please shout
if I should drop that instead.

Arnd