Re: [PATCH 01/14] xfs: add xattr setname and removename functions for internal users

Christoph Hellwig
2024-04-10T06:18:03Z

> +static int
> +xfs_attr_ensure_iext(
> + struct xfs_da_args *args,
> + int nr)
> +{
> + int error;
> +
> + error = xfs_iext_count_may_overflow(args->dp, XFS_ATTR_FORK, nr);
> + if (error == -EFBIG)
> + return xfs_iext_count_upgrade(args->trans, args->dp, nr);
> + return error;
> +}

I'd rather get my consolidation of these merged instead of adding
a wrapper like this. Just waiting for my RT delalloc and your
exchrange series to hit for-next to resend it.

> +/*
> + * Ensure that the xattr structure maps @args->name to @args->value.
> + *
> + * The caller must have initialized @args, attached dquots, and must not hold
> + * any ILOCKs. Only XATTR_CREATE may be specified in @args->xattr_flags.
> + * Reserved data blocks may be used if @rsvd is set.
> + *
> + * Returns -EEXIST if XATTR_CREATE was specified and the name already exists.
> + */
> +int
> +xfs_attr_setname(

Is there any case where we do not want to pass XATTR_CREATE, that
is replace an existing attribute when there is one?

> +int
> +xfs_attr_removename(
> + struct xfs_da_args *args,
> + bool rsvd)
> +{

Is there a good reason to have a separate remove helper and not
overload a NULL value like we do for the normal xattr interface?