Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "koraynilay" <koray.fra@gmail.com>
To: "koraynilay" <koray.fra@gmail.com>,
	"Amir Goldstein" <amir73il@gmail.com>
Cc: "Namjae Jeon" <linkinjeon@kernel.org>,
	"Hyunchul Lee" <hyc.lee@gmail.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Eric Biggers" <ebiggers@kernel.org>,
	"Theodore Y . Ts'o" <tytso@mit.edu>,
	"Jaegeuk Kim" <jaegeuk@kernel.org>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Christian Brauner" <brauner@kernel.org>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Chuck Lever" <cel@kernel.org>,
	"Jeff Layton" <jlayton@kernel.org>, "Jan Kara" <jack@suse.cz>,
	"Alexander Aring" <alex.aring@gmail.com>,
	"Darrick J . Wong" <djwong@kernel.org>,
	"Andrey Albershteyn" <aalbersh@kernel.org>,
	"Miklos Szeredi" <miklos@szeredi.hu>,
	"Pali Rohár" <pali@kernel.org>,
	"Lauri Gates" <lauri.gates@gmail.com>,
	"Christoph Hellwig" <hch@infradead.org>,
	"Dave Chinner" <dgc@kernel.org>,
	linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	ntfs@lists.linux.dev, linux-nfs@vger.kernel.org,
	linux-api@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-unionfs@vger.kernel.org
Subject: Re: [PATCH v3 2/5] vfs: add xflags masks to fileattr API
Date: Mon, 30 Nov 2026 22:29:06 +0100	[thread overview]
Message-ID: <DN8V5C2BTUDM.3U916QR7M5WVR@gmail.com> (raw)
In-Reply-To: <DN8V29K4KGG4.DIS2Z9VGT34B@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 6008 bytes --]

On Mon Nov 30, 2026 at 10:25 PM CET, koraynilay wrote:
> On Mon Nov 30, 2026 at 10:04 PM CET, Amir Goldstein wrote:
>> On Mon, Nov 30, 2026 at 6:22 PM koraynilay <koray.fra@gmail.com> 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?
>
> Ah yes, typo.
>
>>> 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 ;)
>
> 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.

Another option for FS_XFLAGS_FSXATTR_RW_MASK is FS_XFLAGS_NOMASK_RW,
which I like a bit more but I'm not sure.

(Forgot in the previous reply)

>>> 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?
>
> FSX_IMMUTABLE
> FSX_PROJID
>
> FSX_RDONLY_MASK
> FSX_FSXATTR_MASK
> FSX_FILEATTR_MASK
>
> or if FS_ is important:
>
> FS_FSX_IMMUTABLE
> FS_FSX_PROJID
>
> FS_FSX_RDONLY_MASK
> FS_FSX_FSXATTR_MASK
> FS_FSX_FILEATTR_MASK
>
> or maybe?
>
> FS_XFL_IMMUTABLE
> FS_XFL_PROJID
>
> FS_XFL_RDONLY_MASK
> FS_XFL_FSXATTR_MASK
> FS_XFL_FILEATTR_MASK
>
> 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).
>
>> 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
>
>>> > 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 :)
>
> Thanks,
> koraynilay
>
>> Thanks,
>> Amir.



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-11-30 21:29 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  2:42 [PATCH v3 0/5] Add f*_xflags_{rw,ro}_mask flags to the fileattr API koraynilay
2026-11-29  2:42 ` [PATCH v3 1/5] vfs: use goto out on error in vfs_fileattr_set() koraynilay
2026-11-29  9:32   ` Amir Goldstein
2026-11-29 13:23     ` koraynilay
2026-11-29  2:42 ` [PATCH v3 2/5] vfs: add xflags masks to fileattr API koraynilay
2026-11-29 13:10   ` Lauri Gates
2026-11-29 13:57     ` Amir Goldstein
2026-11-30 18:43     ` koraynilay
2026-11-30 19:44       ` Lauri Gates
2026-11-30 22:02         ` koraynilay
2026-11-29 14:23   ` Amir Goldstein
2026-11-29 21:44     ` koraynilay
2026-11-29 22:22       ` koraynilay
2026-11-30  0:00       ` Amir Goldstein
2026-11-30 11:23         ` koraynilay
2026-11-30 11:28           ` koraynilay
2026-11-30 15:53             ` Amir Goldstein
2026-11-30 17:22               ` koraynilay
2026-11-30 21:04                 ` Amir Goldstein
2026-11-30 21:25                   ` koraynilay
2026-11-30 21:29                     ` koraynilay [this message]
2026-11-29  2:42 ` [PATCH v3 3/5] vfs: add COMPR/ENCRYPT xflags from FS_COMPR_FL/FS_ENCRYPT_FL koraynilay
2026-11-29 10:11   ` Amir Goldstein
2026-11-29 18:20     ` koraynilay
2026-11-29 21:30       ` Amir Goldstein
2026-11-29 21:55         ` koraynilay
2026-11-29  2:42 ` [PATCH v3 4/5] ntfs: switch to the new xflags fileattr API koraynilay
2026-11-29  9:12   ` Amir Goldstein
2026-11-29 17:51     ` koraynilay
2026-11-29 21:18       ` Amir Goldstein
2026-11-29 22:05         ` koraynilay
2026-11-29 22:20           ` Amir Goldstein
2026-11-29  2:42 ` [PATCH v3 5/5] docs: add fileattr API documentation koraynilay
2026-11-29 11:32   ` Amir Goldstein
2026-11-29 14:19     ` koraynilay
2026-11-29 22:11       ` Amir Goldstein
2026-11-30 13:33   ` Andrey Albershteyn
2026-11-30 14:10     ` koraynilay
2026-11-30 15:24       ` Amir Goldstein
2026-11-29  2:47 ` [PATCH v3 0/5] Add f*_xflags_{rw,ro}_mask flags to the fileattr API koraynilay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DN8V5C2BTUDM.3U916QR7M5WVR@gmail.com \
    --to=koray.fra@gmail.com \
    --cc=aalbersh@kernel.org \
    --cc=alex.aring@gmail.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=cel@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dgc@kernel.org \
    --cc=djwong@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=hch@infradead.org \
    --cc=hyc.lee@gmail.com \
    --cc=jack@suse.cz \
    --cc=jaegeuk@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=lauri.gates@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=ntfs@lists.linux.dev \
    --cc=pali@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox