Re: [PATCH 0/3] Add f*_xflags_{rw,ro}_mask flags to the fileattr API

From: koraynilay

Date: Mon Nov 23 2026 - 17:57:12 EST


On Mon Nov 23, 2026 at 11:47 PM CET, Amir Goldstein wrote:
> On Mon, Nov 23, 2026 at 10:45 PM koraynilay <koray.fra@xxxxxxxxx> wrote:
>>
>> On Mon Nov 23, 2026 at 2:35 PM CET, Amir Goldstein wrote:
>> > On Sun, Nov 22, 2026 at 1:09 AM koraynilay <koray.fra@xxxxxxxxx> wrote:
>> >>
>> >> This is a follow up patch series stemmed from [1] and [2], splitting the
>> >> _mask change for the fileattr API into its own separate patch.
>> >>
>> >> The first patch is a preparatory patch so that the code in the patch
>> >> after can be formatted better.
>> >>
>> >> The second patch is the actual implementation, which introduces:
>> >> - fa_xflags_{rw,ro}_mask fields to struct file_attr
>> >> - fsx_xflags_{rw,ro}_mask fields and has_masks selector to struct file_kattr
>> >>
>> >> These masks have the following semantics:
>> >> - rw_mask:
>> >> * for filesystems: advertise which xflags they support changing
>> >> * for userspace: specify which xflags it wants to modify
>> >> - ro_mask:
>> >> * for filesystems: advertise which xflags they support only reading
>> >> * for userspace: ignored
>> >
>> > Nice!
>> > I think this API description is very clear and coherent
>>
>> By the way, should I use this description in the commit message (and
>
> You could use that as a short TLDR intro

Hmm, then would it be better keep only this for the commit message

>> integrate it with missing information before/after the bullet points),
>> or should I keep the current one?
>>
>> (current one:)
>> > This lets filesystems advertise their support for specific xflags, like
>> > statx.stx_attributes_mask does, and userspace can specify only which
>> > xflags it wants to change without needing a RMW cycle:
>> > - on GET: each filesystem that wants to support this new API fills the
>> > masks according to its supported and read-only xflags, then:
>> > * for boolean xflags: it fills fsx_xflags with the current on-disk value
>> > * for value xflags: it sets the xflag bit to 1 in fsx_xflags and the
>> > xflag value in the struct field;
>> > - on SET: userspace fills the rw_mask with the bits of the xflags it
>> > wants to change, then:
>> > * for boolean xflags: it provides the xflag value as a bit in fa_xflags
>> > * for value xflags: it sets the xflag bit to 1 in fa_xflags and then
>> > provides the value in the struct field; if the xflag bit is set to 0
>> > instead, this informs the kernel to unset/clear that value.
>
> You can keep it also but tbh UAPI documentation is more useful in
> comments and in Documentation than in commit messages.

and add a documentation patch that uses this (maybe expanded/clearer
since it would be user-facing docs)?

> You and I have parts of the design in our heads w.r.t backward
> compat with legacy API, both UAPI and vfs internal api.
>
> I think you should put it in writing to see that you and I have
> not left anything out because this v1 surely does get it wrong
> in several places both wrt legacy UAPI breakage and internal
> API correctness.

It would also be useful for this actually, so I'll draft it tomorrow
and then send it as part of the patch series.

Thanks,
koraynilay

> Thanks,
> Amir.


Attachment: signature.asc
Description: PGP signature