Re: [PATCH] xfs: add static size checks for structures in xfs_fs.h

From: Wilfred Mallawa

Date: Mon Feb 09 2026 - 02:05:23 EST


On Fri, 2026-02-06 at 07:08 +0100, Christoph Hellwig wrote:
> On Fri, Feb 06, 2026 at 01:05:58PM +1000, Wilfred Mallawa wrote:
> > From: Wilfred Mallawa <wilfred.mallawa@xxxxxxx>
> >
> > This patch adds static size checks for the structures in
> > libxfs/xfs_fs.h.
>
> That's very useful, as adding new fields can mess them up, thanks!
>
> Nit on the commit message: "This patch ..." is redundant and get some
> maintainers enraged. 

Ha thanks for the heads up! will keep that in mind.

> Maybe also amend this blurb to mention why we want
> the size checks:
>
> Add static size checks for the ioctl UAPI structures in
> libxfs/xfs_fs.h..
>
> > The structures with architecture dependent size for
> > fields are ommited from this patch (such as xfs_bstat which depends
> > on
> > __kernel_long_t).
>
> Good point.  Maybe also add this as a commen in the code?

As Dave mentioned, I did not consider the alignment requirements being
different on 32b for example. So I did see some errors for the
following structs from testbot:


xfs_flock64
xfs_fsop_geom_v1
xfs_growfs_data_t
xfs_growfs_rt_t
xfs_inogrp

So we may have to omit these altogether? I'm not sure if this patch
would cause issues for other configs the testbot isn't catching? Any
thoughts?

>
> > Also remove some existing duplicate entries of
> > XFS_CHECK_STRUCT_SIZE().
>
> Oh, good on.  This should probably be split into a separate
> patch.  I'd also keep the first occurrence and remove those under
> the "/* ondisk dir/attr structures from xfs/122 */" label.

Okay that sounds good!

Regards,
Wilfred