Re: [PATCH 4/4] xfs: rearrange xfs_da_args a bit to use less space

Christoph Hellwig
2024-04-10T05:02:46Z

On Tue, Apr 09, 2024 at 05:50:23PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> A few notes about struct xfs_da_args:
>
> The XFS_ATTR_* flags only go up as far as XFS_ATTR_INCOMPLETE, which
> means that attr_filter could be a u8 field.
>
> The XATTR_* flags only have two values, which means that xattr_flags
> could be shrunk to a u8.
>
> I've reduced the number of XFS_DA_OP_* flags down to the point where
> op_flags would also fit into a u8.
>
> filetype has 7 bytes of slack after it, which is wasteful.
>
> namelen will never be greater than MAXNAMELEN, which is 256. This field
> could be reduced to a short.
>
> Rearrange the fields in xfs_da_args to waste less space. This reduces
> the structure size from 136 bytes to 128. Later when we add extra
> fields to support parent pointer replacement, this will only bloat the
> structure to 144 bytes, instead of 168.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Eventually we should probaly split this up, at lot of fields are
used only by the attr set code, and a few less only by dir vs attr.