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

From: Christoph Hellwig

Date: Fri Feb 06 2026 - 01:08:24 EST


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. 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?

> 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.

> + /* direct I/O */
> + XFS_CHECK_STRUCT_SIZE(struct dioattr, 12);

It probably make sense to keep the uapi ones a bit separated from
the on-disk ones. I.e. add a

/* ioctl UABI */

comment at end end, move xfs_bulkstat/xfs_inumbers/xfs_bulkstat_req/
xfs_inumbers_req there and add all the new ones.