Re: [PATCH v3 2/5] vfs: add xflags masks to fileattr API

From: koraynilay

Date: Tue Dec 01 2026 - 16:22:55 EST


On Tue Dec 1, 2026 at 9:22 PM CET, Amir Goldstein wrote:
> On Tue, Dec 1, 2026 at 8:51 PM koraynilay <koray.fra@xxxxxxxxx> wrote:
>>
>> On Mon Nov 30, 2026 at 11:54 PM CET, Amir Goldstein wrote:
>> > On Mon, Nov 30, 2026 at 10:25 PM koraynilay <koray.fra@xxxxxxxxx> wrote:
>> >>
>> > ...
>> >
>> >> > This is exactly what I was looking for.
>> >> > PROJID is only singled out in one place (here) when defining the macro
>> >> > and a comment above the macro explains why.
>> >> > From this point on the macro describes a trait, which has a very clear
>> >> > meaning, without mentioning any specific flag.
>> >> >
>> >> > Good job, bot ;)
>> >>
>> >> Yes, though, when trying to change the current code to use it, I'm not
>> >> liking the name too much, since it seems like it's a subset of
>> >> FS_XFLAGS_FSXATTR_MASK, while it's actually not, since
>> >> FS_XFLAGS_FSXATTR_MASK does not include PROJID.
>> >>
>> >
>> > IDK, you can try _[GS]ET_MASK
>> > it's a more accurate description.
>>
>> (definition reminder:)
>>
>> /*
>> * Writable xflags used to check and convert from masked request to unmasked
>> * request.
>> * Includes FS_XFLAG_PROJID because masked requests use it but unmasked
>> * filesystems that support fsx_projid don't know about it (because
>> * FS_IOC_FSSETXATTR has no FS_XFLAG_PROJID bit).
>> */
>
> If they don't know about it why don't we strip it?
> This comment does not explain this at all.
>
> Let me try:
> /*
> * xflags that can be changed on a filesystem that does not support masks.
> * The VFS converts a masked request to an FS_IOC_FSSETXATTR style request
> * for such a filesystem, so these are the writable xflags of that interface.
> * FS_IOC_FSSETXATTR has no FS_XFLAG_PROJID, but it can change the project
> * ID via fsx_projid. A masked request selects a project ID change with
> * FS_XFLAG_PROJID, so it is allowed here and converted to fsx_projid.
> */

Rewrote (the robot + edited by me) yours a little bit so it flows
better:

/*
* Writable xflags for filesystems that don't support masks.
* The VFS converts masked requests to FS_IOC_FSSETXATTR format, which lacks
* FS_XFLAG_PROJID and uses only file_kattr.fsx_projid instead.
* Include FS_XFLAG_PROJID here so masked callers can use it to select project
* ID changes on unmasked filesystems.
*/
#define FSX_FSXATTR_SET_MASK \
((FSX_FSXATTR_MASK & ~FSX_RDONLY_MASK) | FS_XFLAG_PROJID)

>>
>>
>> Which of these do you think is better?
>>
>> FSX_FSXATTR_SET_MASK
>> FSX_SET_MASK
>> FSX_UNMASK_CONV_MASK
>> FSX_UNMASKED_SET_MASK
>> FSX_CONVERT_SET_MASK
>> FSX_COMPAT_SET_MASK
>
> FSX_FSXATTR_SET_MASK is ok.
> None of the other names make much sense to me.

Hmm, ok.

> You could consider FSX_FSXATTR_MODIFIABLE
> named after FS_FL_USER_MODIFIABLE.

Yeah that's basically the same as _SET_, so I'll keep _SET_.
What I don't like too much is the "FSXATTR", though since the project id
is part of fsxattr, in that case it kinda makes sense.

Thanks,
koraynilay

> I don't think it is better than _SET_MASK, but I could live with either.
>
> Thanks,
> Amir.


Attachment: signature.asc
Description: PGP signature