From: "koraynilay" <koray.fra@gmail.com>
To: "Amir Goldstein" <amir73il@gmail.com>,
"koraynilay" <koray.fra@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 v5 02/12] fs,overlayfs: rename FS_XFLAGS_MASK and shorten other internal macro names
Date: Sat, 05 Dec 2026 23:42:44 +0100 [thread overview]
Message-ID: <DND5UFNAGR68.3LL0L2F89B9UY@gmail.com> (raw)
In-Reply-To: <CAOQ4uxgfm6kqvGvDAXx2KtV43gKMcMmyDudAcCDeW_eod9iQ=A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 9452 bytes --]
On Sat Dec 5, 2026 at 9:09 PM CET, Amir Goldstein wrote:
> On Sat, Dec 5, 2026 at 3:24 PM koraynilay <koray.fra@gmail.com> wrote:
>>
>> Rename FS_XFLAGS_MASK to FSX_FSXATTR_MASK and make the internal xflags
>> collection macros' names shorter so the code that uses them can be
>> cleaner and more readable.
>>
>> Add an explanatory comment for FS_COMMON_FL/FSX_COMMON, FSX_RDONLY_MASK
>> and FSX_FSXATTR_MASK, so it's clearer which xflags they include.
>>
>> Also add FSX_EXTSIZE_MASK to avoid long lines caused only by OR'ing
>> FS_XFLAG_EXTSIZE and FS_XFLAG_EXTSZINHERIT.
>>
>> Don't touch the names of the actual xflags macros as those are exposed
>> to userspace so they can't be easily changed.
>>
>> Signed-off-by: koraynilay <koray.fra@gmail.com>
>> ---
>>
>> Sorry, dropped Reviewed-by: Amir Goldstein <amir73il@gmail.com> because
>> I added FSX_EXTSIZE_MASK.
>> (Wasn't sure if I could keep it or not)
>
> As long as you say what you change the re-review is easy so now
> may restore my RVB thanks.
Ok thanks.
> One comment though
>
> fs,overlayfs: rename FS_XFLAGS_MASK...
>
> lose the ",overlayfs" prefix please - it's out of context and
> a very robotic thing to do.
>
> The commit message is NOT a list of changed subsystem
>
> THIS is an fs: change. As such it can affect several filesystems
> it happens to affect only one (overlayfs)
Ah ok, yeah that makes sense.
Thanks,
koraynilay
> Thanks,
> Amir.
>
>>
>> Thanks.
>>
>> fs/file_attr.c | 16 ++++++++--------
>> fs/overlayfs/copy_up.c | 2 +-
>> fs/overlayfs/inode.c | 2 +-
>> include/linux/fileattr.h | 34 +++++++++++++++++++++++-----------
>> 4 files changed, 33 insertions(+), 21 deletions(-)
>>
>> diff --git a/fs/file_attr.c b/fs/file_attr.c
>> index 0f2975c9b7bc..cc1621d3b710 100644
>> --- a/fs/file_attr.c
>> +++ b/fs/file_attr.c
>> @@ -102,7 +102,7 @@ EXPORT_SYMBOL(vfs_fileattr_get);
>> static void fileattr_to_file_attr(const struct file_kattr *fa,
>> struct file_attr *fattr)
>> {
>> - __u32 mask = FS_XFLAGS_MASK;
>> + __u32 mask = FSX_FSXATTR_MASK;
>>
>> memset(fattr, 0, sizeof(struct file_attr));
>> fattr->fa_xflags = fa->fsx_xflags & mask;
>> @@ -122,7 +122,7 @@ static void fileattr_to_file_attr(const struct file_kattr *fa,
>> int copy_fsxattr_to_user(const struct file_kattr *fa, struct fsxattr __user *ufa)
>> {
>> struct fsxattr xfa;
>> - __u32 mask = FS_XFLAGS_MASK;
>> + __u32 mask = FSX_FSXATTR_MASK;
>>
>> memset(&xfa, 0, sizeof(xfa));
>> xfa.fsx_xflags = fa->fsx_xflags & mask;
>> @@ -141,12 +141,12 @@ EXPORT_SYMBOL(copy_fsxattr_to_user);
>> static int file_attr_to_fileattr(const struct file_attr *fattr,
>> struct file_kattr *fa)
>> {
>> - __u64 mask = FS_XFLAGS_MASK;
>> + __u64 mask = FSX_FSXATTR_MASK;
>>
>> if (fattr->fa_xflags & ~mask)
>> return -EINVAL;
>>
>> - fileattr_fill_xflags(fa, fattr->fa_xflags & ~FS_XFLAG_RDONLY_MASK);
>> + fileattr_fill_xflags(fa, fattr->fa_xflags & ~FSX_RDONLY_MASK);
>> fa->fsx_extsize = fattr->fa_extsize;
>> fa->fsx_projid = fattr->fa_projid;
>> fa->fsx_cowextsize = fattr->fa_cowextsize;
>> @@ -158,7 +158,7 @@ static int copy_fsxattr_from_user(struct file_kattr *fa,
>> struct fsxattr __user *ufa)
>> {
>> struct fsxattr xfa;
>> - __u32 mask = FS_XFLAGS_MASK;
>> + __u32 mask = FSX_FSXATTR_MASK;
>>
>> if (copy_from_user(&xfa, ufa, sizeof(xfa)))
>> return -EFAULT;
>> @@ -166,7 +166,7 @@ static int copy_fsxattr_from_user(struct file_kattr *fa,
>> if (xfa.fsx_xflags & ~mask)
>> return -EOPNOTSUPP;
>>
>> - fileattr_fill_xflags(fa, xfa.fsx_xflags & ~FS_XFLAG_RDONLY_MASK);
>> + fileattr_fill_xflags(fa, xfa.fsx_xflags & ~FSX_RDONLY_MASK);
>> fa->fsx_extsize = xfa.fsx_extsize;
>> fa->fsx_nextents = xfa.fsx_nextents;
>> fa->fsx_projid = xfa.fsx_projid;
>> @@ -247,7 +247,7 @@ static int fileattr_set_prepare(struct inode *inode,
>>
>> /* Extent size hints of zero turn off the flags. */
>> if (fa->fsx_extsize == 0)
>> - fa->fsx_xflags &= ~(FS_XFLAG_EXTSIZE | FS_XFLAG_EXTSZINHERIT);
>> + fa->fsx_xflags &= ~FSX_EXTSIZE_MASK;
>> if (fa->fsx_cowextsize == 0)
>> fa->fsx_xflags &= ~FS_XFLAG_COWEXTSIZE;
>>
>> @@ -290,7 +290,7 @@ int vfs_fileattr_set(const struct mnt_idmap *idmap, struct dentry *dentry,
>>
>> /* initialize missing bits from old_ma */
>> if (fa->flags_valid) {
>> - fa->fsx_xflags |= old_ma.fsx_xflags & ~FS_XFLAG_COMMON;
>> + fa->fsx_xflags |= old_ma.fsx_xflags & ~FSX_COMMON;
>> fa->fsx_extsize = old_ma.fsx_extsize;
>> fa->fsx_nextents = old_ma.fsx_nextents;
>> fa->fsx_projid = old_ma.fsx_projid;
>> diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
>> index c147ad155b79..20f369863faf 100644
>> --- a/fs/overlayfs/copy_up.c
>> +++ b/fs/overlayfs/copy_up.c
>> @@ -220,7 +220,7 @@ static int ovl_copy_fileattr(struct inode *inode, const struct path *old,
>> newfa.flags &= ~OVL_COPY_FS_FLAGS_MASK;
>> newfa.flags |= (oldfa.flags & OVL_COPY_FS_FLAGS_MASK);
>>
>> - BUILD_BUG_ON(OVL_COPY_FSX_FLAGS_MASK & ~FS_XFLAG_COMMON);
>> + BUILD_BUG_ON(OVL_COPY_FSX_FLAGS_MASK & ~FSX_COMMON);
>> newfa.fsx_xflags &= ~OVL_COPY_FSX_FLAGS_MASK;
>> newfa.fsx_xflags |= (oldfa.fsx_xflags & OVL_COPY_FSX_FLAGS_MASK);
>>
>> diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
>> index f1c6df39d0ae..92df4f5c071e 100644
>> --- a/fs/overlayfs/inode.c
>> +++ b/fs/overlayfs/inode.c
>> @@ -709,7 +709,7 @@ int ovl_fileattr_set(const struct mnt_idmap *idmap,
>> static void ovl_fileattr_prot_flags(struct inode *inode, struct file_kattr *fa)
>> {
>> BUILD_BUG_ON(OVL_PROT_FS_FLAGS_MASK & ~FS_COMMON_FL);
>> - BUILD_BUG_ON(OVL_PROT_FSX_FLAGS_MASK & ~FS_XFLAG_COMMON);
>> + BUILD_BUG_ON(OVL_PROT_FSX_FLAGS_MASK & ~FSX_COMMON);
>>
>> if (inode->i_flags & S_APPEND) {
>> fa->flags |= FS_APPEND_FL;
>> diff --git a/include/linux/fileattr.h b/include/linux/fileattr.h
>> index 09e32b84e02a..79371aa93a61 100644
>> --- a/include/linux/fileattr.h
>> +++ b/include/linux/fileattr.h
>> @@ -3,37 +3,49 @@
>> #ifndef _LINUX_FILEATTR_H
>> #define _LINUX_FILEATTR_H
>>
>> -/* Flags shared betwen flags/xflags */
>> +/*
>> + * FS_COMMON_FL/FSX_COMMON are preserved through an RMW cycle via either UAPI
>> + * flavor. They must NOT include flags that are read-write via one API flavor
>> + * and read-only in another (e.g. CASEFOLD).
>> + */
>> #define FS_COMMON_FL \
>> (FS_SYNC_FL | FS_IMMUTABLE_FL | FS_APPEND_FL | \
>> FS_NODUMP_FL | FS_NOATIME_FL | FS_DAX_FL | \
>> FS_PROJINHERIT_FL | FS_VERITY_FL)
>>
>> -#define FS_XFLAG_COMMON \
>> +#define FSX_COMMON \
>> (FS_XFLAG_SYNC | FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND | \
>> FS_XFLAG_NODUMP | FS_XFLAG_NOATIME | FS_XFLAG_DAX | \
>> FS_XFLAG_PROJINHERIT | FS_XFLAG_VERITY)
>>
>> -/* Read-only inode flags */
>> -#define FS_XFLAG_RDONLY_MASK \
>> +/*
>> + * Read-only xflags via FS_IOC_FS[GS]ETXATTR and file_[gs]etattr().
>> + * The respective flags may still be read-write via FS_IOC_SETFLAGS.
>> + */
>> +#define FSX_RDONLY_MASK \
>> (FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY | \
>> FS_XFLAG_CASEFOLD | FS_XFLAG_CASENONPRESERVING)
>>
>> /* Flags to indicate valid value of fsx_ fields */
>> -#define FS_XFLAG_VALUES_MASK \
>> +#define FSX_VALUES_MASK \
>> (FS_XFLAG_EXTSIZE | FS_XFLAG_COWEXTSIZE)
>>
>> /* Flags for directories */
>> -#define FS_XFLAG_DIRONLY_MASK \
>> +#define FSX_DIRONLY_MASK \
>> (FS_XFLAG_RTINHERIT | FS_XFLAG_NOSYMLINKS | FS_XFLAG_EXTSZINHERIT)
>>
>> /* Misc settable flags */
>> -#define FS_XFLAG_MISC_MASK \
>> +#define FSX_MISC_MASK \
>> (FS_XFLAG_REALTIME | FS_XFLAG_NODEFRAG | FS_XFLAG_FILESTREAM)
>>
>> -#define FS_XFLAGS_MASK \
>> - (FS_XFLAG_COMMON | FS_XFLAG_RDONLY_MASK | FS_XFLAG_VALUES_MASK | \
>> - FS_XFLAG_DIRONLY_MASK | FS_XFLAG_MISC_MASK)
>> +/* Flags for fa/fsx_extsize value fields */
>> +#define FSX_EXTSIZE_MASK \
>> + (FS_XFLAG_EXTSIZE | FS_XFLAG_EXTSZINHERIT)
>> +
>> +/* Flags supported by FS_IOC_FS[GS]ETXATTR and file_[gs]etattr() */
>> +#define FSX_FSXATTR_MASK \
>> + (FSX_COMMON | FSX_RDONLY_MASK | FSX_VALUES_MASK | \
>> + FSX_DIRONLY_MASK | FSX_MISC_MASK)
>>
>> /*
>> * Merged interface for miscellaneous file attributes. 'flags' originates from
>> @@ -69,7 +81,7 @@ void fileattr_fill_flags(struct file_kattr *fa, u32 flags);
>> static inline bool fileattr_has_fsx(const struct file_kattr *fa)
>> {
>> return fa->fsx_valid &&
>> - ((fa->fsx_xflags & ~FS_XFLAG_COMMON) || fa->fsx_extsize != 0 ||
>> + ((fa->fsx_xflags & ~FSX_COMMON) || fa->fsx_extsize != 0 ||
>> fa->fsx_projid != 0 || fa->fsx_cowextsize != 0);
>> }
>>
>> --
>> 2.56.1.dirty
>>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-12-05 22:42 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 14:23 [PATCH v5 00/12] Add f*_xflags_{rw,ro}_mask flags to the fileattr API koraynilay
2026-12-05 14:24 ` [PATCH v5 01/12] fs: use goto out on error in vfs_fileattr_set() koraynilay
2026-12-05 14:24 ` [PATCH v5 02/12] fs,overlayfs: rename FS_XFLAGS_MASK and shorten other internal macro names koraynilay
2026-12-05 20:09 ` Amir Goldstein
2026-12-05 22:42 ` koraynilay [this message]
2026-12-05 14:24 ` [PATCH v5 03/12] fs: move fileattr sizes out of uapi and factor out set_preserve() koraynilay
2026-12-05 22:15 ` Amir Goldstein
2026-12-05 14:24 ` [PATCH v5 04/12] fs: switch fileattr_set_prepare() to xflags and refactor projid check koraynilay
2026-12-05 14:24 ` [PATCH v5 05/12] fs: add initial implementation of xflags masks to fileattr API koraynilay
2026-12-05 14:24 ` [PATCH v5 06/12] fs: add UAPI " koraynilay
2026-12-05 14:24 ` [PATCH v5 07/12] fs: add missing FS_XFLAG_PROJID xflag koraynilay
2026-12-05 22:08 ` Amir Goldstein
2026-12-05 14:24 ` [PATCH v5 08/12] fs,overlayfs: add fileattr masks support on get koraynilay
2026-12-05 21:42 ` Amir Goldstein
2026-12-05 14:24 ` [PATCH v5 09/12] fs,ntfs: advertise COMPR/ENCRYPT xflags in file_getattr() koraynilay
2026-12-05 20:21 ` Amir Goldstein
2026-12-05 20:41 ` Amir Goldstein
2026-12-05 14:24 ` [PATCH v5 10/12] ntfs: switch from flags to xflags in ntfs_fileattr_get/set() koraynilay
2026-12-05 20:25 ` Amir Goldstein
2026-12-05 21:31 ` Amir Goldstein
2026-12-05 14:24 ` [PATCH v5 11/12] ntfs: support the fileattr API masks " koraynilay
2026-12-05 21:15 ` Amir Goldstein
2026-12-05 14:24 ` [PATCH v5 12/12] docs: add fileattr API documentation koraynilay
2026-12-05 21:14 ` Amir Goldstein
2026-12-05 22:24 ` 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=DND5UFNAGR68.3LL0L2F89B9UY@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.