On Mon Nov 23, 2026 at 2:00 PM CET, Amir Goldstein wrote: > On Sun, Nov 22, 2026 at 1:09 AM koraynilay wrote: >> >> Switch ntfs_fileattr_[gs]et() from the legacy FS_*_FL flags to the >> modern xflags (FS_XFLAG_*) fileattr API with masks. >> >> Introduce FS_XFLAG_COMPR and FS_XFLAG_ENCRYPT and add them to >> FS_XFLAG_COMMON (and add FS_COMPR_FL and FS_ENCRYPT_FL to FS_COMMON_FL) >> to be used in this API switch. >> >> Assisted-by: Gemini:3.8-flash-high antigravity-cli-1.5.11 >> Signed-off-by: koraynilay >> --- >> fs/file_attr.c | 8 +++++ >> fs/ntfs/file.c | 63 +++++++++++++++++++--------------------- >> include/linux/fileattr.h | 6 ++-- >> include/uapi/linux/fs.h | 2 ++ >> 4 files changed, 44 insertions(+), 35 deletions(-) >> > ... > >> diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c >> index 50be49f4c913..fde6fb2fe39c 100644 >> --- a/fs/ntfs/file.c >> +++ b/fs/ntfs/file.c >> @@ -155,31 +155,37 @@ int ntfs_file_release(struct inode *vi, struct file *filp) >> * @dentry: dentry to report the flags of >> * @fa: filled in with the flags of @dentry >> */ >> +#define NTFS_RO_XFLAGS (FS_XFLAG_COMPR | FS_XFLAG_ENCRYPT | FS_XFLAG_CASEFOLD) >> +#define NTFS_RW_XFLAGS (FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND | \ >> + FS_XFLAG_NOATIME | FS_XFLAG_NODUMP) > > Nit: checkpatch may allow 100 chars, but this due formatting is not > easy on the eyes > pls break to RO line It should be 78 and imo it looks fine, but yes, I'll split it in next patch. > and indent the broken lines below ( This should be a diff-only problem, in my working tree the file has them correctly indented using 3 tabs (wide 8) and 0 space, probably same problem as the PROJID line being unaligned here: >> #define FS_XFLAG_PROJID 0x00100000 /* project ID */ >> +#define FS_XFLAG_COMPR 0x00200000 /* Compress file */ > >> diff --git a/include/linux/fileattr.h b/include/linux/fileattr.h >> index 4faa40febf11..219e7c8eb601 100644 >> --- a/include/linux/fileattr.h >> +++ b/include/linux/fileattr.h >> @@ -7,12 +7,14 @@ >> #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) >> + FS_PROJINHERIT_FL | FS_VERITY_FL | FS_COMPR_FL | \ >> + FS_ENCRYPT_FL) >> >> #define FS_XFLAG_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) >> + FS_XFLAG_PROJINHERIT | FS_XFLAG_VERITY | FS_XFLAG_COMPR | \ >> + FS_XFLAG_ENCRYPT) > > > Rule: > > You cannot add a flag to common without carefully auditing all > filesystems that support the legacy flag. Yeah, sashiko pointed out a problem in f2fs, and I could reproduce it in testing, where adding COMPR to COMMON makes f2fs crash, it also needs NOCOMP in COMMON. > FS_XFLAG_ENCRYPT can go into common but must also > go to FS_XFLAG_RDONLY_MASK because it's read-only for > all existing fs. > > COMPR is rw for some fs and ro for others. > As with CASEFOLD, you cannot make it COMMON before > converting all casefold fs to new API so that each can say > whether it wants RO or RW. How's CASEFOLD currently handled? in the v2 I'm drafting, I added fileattr_mask_to_legacy() and fileattr_legacy_to_mask(), which convert between the old format (filtering by FS_XFLAGS_MASK) and the new mask format. > I think there may be a way to deal with this easily since > ntfs doesn't need to set either but not sure. We could export the 2 other helpers I added for v2 (xflags_to_flags and flags_to_xflags) and make NTFS use them? Though adding the fileattr_ prefix will make the current (v2) vfs code maybe too verbose. >> >> /* Read-only inode flags */ >> #define FS_XFLAG_RDONLY_MASK \ >> diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h >> index e40806b3a69c..09fc7e066485 100644 >> --- a/include/uapi/linux/fs.h >> +++ b/include/uapi/linux/fs.h >> @@ -275,6 +275,8 @@ struct file_attr { >> #define FS_XFLAG_CASENONPRESERVING 0x00080000 /* case not preserved */ >> >> #define FS_XFLAG_PROJID 0x00100000 /* project ID */ >> +#define FS_XFLAG_COMPR 0x00200000 /* Compress file */ >> +#define FS_XFLAG_ENCRYPT 0x00400000 /* Encrypted file */ > > This is a mistake of patch 1. the newline should remain above HASATTR > which is allocated from the end. Right, fixed (and removed the blank line between CASENONPRESERVING and PROJID). Thanks, koraynilay > >> #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ >> >> /* the read-only stuff doesn't really belong here, but any other place is > > Thanks, > Amir. >>