Re: [PATCH v3 2/5] vfs: add xflags masks to fileattr API
From: Amir Goldstein
Date: Mon Nov 30 2026 - 16:04:58 EST
On Mon, Nov 30, 2026 at 6:22 PM koraynilay <koray.fra@xxxxxxxxx> wrote:
>
...
> >> >>>
> >> >>> For PROJID, personally it could also just be put in FS_XFLAGS_MASK, my
> >> >>> concern is that it may break programs, even tho fsx_xflags is already
> >> >>> expected to grow (as per your 276e136bff7e ("fs: prepare for extending
> >> >>> file_get/setattr()")).
> >> >>>
> >> >>
> >> >> I am too concerned that this would break programs.
> >> >
> >> > Hmm, I'll ask the robot a bit about solutions to this, but...
> >> > what about adding an exception for PROJID that it must never be set in
> >> > fsx_xflags and only used in rw_mask (so for chattr -p)?
> >> >
> >
> > I don't think this is the answer. Let's see what the bot has to offer.
>
> So the bot said that keeping PROJID outside of FS_FILE_ATTR_XFLAGS_MASK
Don't you mean the other way around?
PROJID is in FS_FILE_ATTR_XFLAGS_MASK and not in
FS_XFLAGS_FSXATTR_MASK?
> is the best solution, and suggested adding
>
> #define FS_XFLAGS_FSXATTR_RW_MASK \
> ((FS_XFLAGS_FSXATTR_MASK & ~FS_XFLAG_RDONLY_MASK) | FS_XFLAG_PROJID)
>
> to be used in the code/docs.
> I'm not sure this is the best, but it would simplify reading the code.
>
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 ;)
> 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).
> 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.
>
> 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.
However, a filesystem can only report a new flag after it has opted into
masks, 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.
>
> 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 :)
> > 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 :)
Thanks,
Amir.