Re: [PATCH 05/22] xfs: pack inode allocation parameters into a separate structure

Christoph Hellwig
2019-01-17T14:21:27Z

On Mon, Dec 31, 2018 at 06:19:32PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Instead of open-coding new inode parameters through xfs_dir_ialloc and
> xfs_Ialloc, put everything into a structure and pass that instead. This
> will make it easier to share code with xfsprogs while maintaining the
> ability for xfsprogs to supply extra new inode parameters.

I find these ad-hoc arg structures rather cumberssome to be honest.

> +/* Initial ids, link count, device number, and mode of a new inode. */
> +struct xfs_ialloc_args {
> + struct xfs_inode *pip; /* parent inode or null */
> +
> + uint32_t uid;
> + uint32_t gid;
> + prid_t prid;
> +
> + xfs_nlink_t nlink;
> + dev_t rdev;
> +
> + umode_t mode;

And except for the parent inode this is a significant subsystet of
stat data. Can't we just pass a struct kstat, and a mask of attributes
from the kstat we want to set instead? That is use a calling convention
similar to ->setattr?