Re: [PATCH v3 2/5] vfs: add xflags masks to fileattr API
From: koraynilay
Date: Mon Nov 30 2026 - 18:05:36 EST
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.
Right, I'll with that as well.
>> >> Also, could we change FS_XFLAGS_FSXATTR_MASK to FS_XFLAGS_FSXATTR? (and
>> >> so also FS_XFLAGS_FSXATTR_RW)
>> >
>> > This reduces readability considerably IMO.
>> > There needs to be a clear separation between the
>> > flag macros and the flag collection macros (traits if you will).
>>
>> Hmm, fair, I proposed this change because the names are getting a bit
>> long and formatting the code is harder, also they have FLAG*S* that can
>> indicate it's a collection, but that's easily missable (and indeed, I
>> can never remember if it's FS_XFLAG_MASK or FS_XFLAGS_MASK, one more
>> reason removing the _MASK may be beneficial, at least to me lol).
>>
>> >> And I'd also change FS_FILE_ATTR_XFLAGS_MASK to maybe only
>> >> FS_FILE_ATTR_MASK, so it's not too long.
>> >
>> > Losing the FS_XFLAGS_ prefix is not good IMO.
>> > I did want to offer a change to FS_XFLAGS_FILEATTR_MASK
>> > to be consistent with the rest of the collection/trait macros.
>>
>> Hmm, right, FS_XFLAGS_FILEATTR_MASK does indeed look better, though it
>> is getting a bit hard to distinguish between them when they have such a
>> long prefix.
>>
>> FS_*_FL are easier to read.
>> Actually, could we maybe do something like FSX_ as prefix, if the FS_
>> prefix is not that important?
>
> It's not that important, but..
>
>>
>> FSX_IMMUTABLE
>
> This is in the uapi and changing them in kernel will be a lot of churn
Yeah, I remembered that after sending the email lol.
>> FSX_PROJID
>>
>> FSX_RDONLY_MASK
>> FSX_FSXATTR_MASK
>> FSX_FILEATTR_MASK
>
> Those are fine by me
Nice, then I'll switch to them if the patch wouldn't be too large.
>>
>> or if FS_ is important:
>>
>> FS_FSX_IMMUTABLE
>> FS_FSX_PROJID
>
> Those not for same reason
>
>>
>> FS_FSX_RDONLY_MASK
>> FS_FSX_FSXATTR_MASK
>> FS_FSX_FILEATTR_MASK
>
> Those fine
>
>>
>> or maybe?
>>
>> FS_XFL_IMMUTABLE
>> FS_XFL_PROJID
>>
>> FS_XFL_RDONLY_MASK
>> FS_XFL_FSXATTR_MASK
>> FS_XFL_FILEATTR_MASK
>
> Those are worse than all of the above IMO
>
>>
>> or something else that is shorter, idk.
>>
>> >>
>> >> And at this point, we should consider all _MASKs to be frozen and only
>> >> expand FS_FILE_ATTR_MASK, with the exception of converterd FS_*_FL
>> >> flags.
>> >
>> > This is something that we can definitely document as a guideline -
>> > use the latest v1 syscall uapi for new flags, with the exception of
>> > xflags for existing FS_*_FL flags.
>>
>> Yes.
>>
>> > However, a filesystem can only report a new flag after it has opted into
>> > masks,
>>
>> Report as RW or as RO?
>>
>> Since for RO reporting it doesn't need to, it just needs to do that for
>> get (and actually, only for the wanted xflag, it probably doesn't even
>> need to report all its xflags in rw/ro masks apart from e.g. MAYSHARE...
>> or maybe not even in the masks, since on the set path vfs treats it as a
>> "legacy RMW"/VER0 filesystem).
>>
>
> Whatever guideline you write - if it makes sense its good,
Fair.
>> > so if a new flag requires converting many filesystems,
>> > it may not be realistic to maintain the freeze rule.
>> >
>> > Hopefully, the work on the may-share flag came just at the right time
>> > to allow for the ro_mask exception, so observing the guideline for
>> > new read-only flags seems doable.
>>
>> Yes, MAYSHARE for testing read-only, BTIME for testing read-write (and
>> read-only).
>>
>> >
>> >>
>> >> so:
>> >>
>> >> FS_XFLAGS_FSXATTR would have the ones that are in right now + all new
>> >> FS_*_FL converted ones (same for RDONLY and COMMON, etc)
>> >>
>> >> FS_FILE_ATTR_MASK would have all FS_XFLAGS_FSXATTR + all new ones
>> >> (MAYSHARE, BTIME, ...).
>> >>
>> >
>> > Yes, it sounds like we are converging :)
>>
>> Yes, though that has been my thinking since the first time I wrote
>> "FS_FILE_ATTR_MASK" for the ptime patch :D
>>
>
> Yeh this is a tough one
> and this is before the patch set got review from a wider audience...
> I praise your perseverance.
I really just want ptime or settable btime, lmao.
>
>> >> > Isn't PROJID in FS_XFLAGS_FILE_ATTR_MASK, but not in
>> >> > FS_XFLAGS_FSXATTR_MASK?
>> >> > Is there more to it than that?
>> >>
>> >> Currently it's set like this, and there shouldn't be anything more to
>> >> it.
>> >>
>> >
>> > Nice. Looking forward to v4.
>> > I hope I have some time to rest before, but probably not :)
>>
>> I should take >= 1 breaks too instead of working on this when I'm not
>> doing other stuff, but I already know I won't :)
>>
>
> Maybe if there is AI outage you can rest :D
I actually finished my normal tokens and using some API credits I got
for free right now, so maybe I'll take it as an excuse :)
Thanks,
koraynilay
> Thanks,
> Amir.
Attachment:
signature.asc
Description: PGP signature