[PATCH] ocfs2: replace ocfs2-specific inode flags with generic ones

From: Anthony Iliopoulos

Date: Tue Aug 25 2026 - 05:11:50 EST


The ocfs2 inode flag macros are alias definitions for the generic fs
flags. Remove these redundant macros, most of which are anyway unused,
and use the generic flags directly.

Signed-off-by: Anthony Iliopoulos <ailiop@xxxxxxxx>
---
fs/ocfs2/inode.c | 24 ++++++++++++------------
fs/ocfs2/ioctl.c | 2 +-
fs/ocfs2/ocfs2_fs.h | 24 ------------------------
3 files changed, 13 insertions(+), 37 deletions(-)

diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 180107a11046..64d92d30aa31 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -107,16 +107,16 @@ void ocfs2_set_inode_flags(struct inode *inode)
inode->i_flags &= ~(S_IMMUTABLE |
S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);

- if (flags & OCFS2_IMMUTABLE_FL)
+ if (flags & FS_IMMUTABLE_FL)
inode->i_flags |= S_IMMUTABLE;

- if (flags & OCFS2_SYNC_FL)
+ if (flags & FS_SYNC_FL)
inode->i_flags |= S_SYNC;
- if (flags & OCFS2_APPEND_FL)
+ if (flags & FS_APPEND_FL)
inode->i_flags |= S_APPEND;
- if (flags & OCFS2_NOATIME_FL)
+ if (flags & FS_NOATIME_FL)
inode->i_flags |= S_NOATIME;
- if (flags & OCFS2_DIRSYNC_FL)
+ if (flags & FS_DIRSYNC_FL)
inode->i_flags |= S_DIRSYNC;
}

@@ -125,18 +125,18 @@ void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi)
{
unsigned int flags = oi->vfs_inode.i_flags;

- oi->ip_attr &= ~(OCFS2_SYNC_FL|OCFS2_APPEND_FL|
- OCFS2_IMMUTABLE_FL|OCFS2_NOATIME_FL|OCFS2_DIRSYNC_FL);
+ oi->ip_attr &= ~(FS_SYNC_FL | FS_APPEND_FL | FS_IMMUTABLE_FL |
+ FS_NOATIME_FL | FS_DIRSYNC_FL);
if (flags & S_SYNC)
- oi->ip_attr |= OCFS2_SYNC_FL;
+ oi->ip_attr |= FS_SYNC_FL;
if (flags & S_APPEND)
- oi->ip_attr |= OCFS2_APPEND_FL;
+ oi->ip_attr |= FS_APPEND_FL;
if (flags & S_IMMUTABLE)
- oi->ip_attr |= OCFS2_IMMUTABLE_FL;
+ oi->ip_attr |= FS_IMMUTABLE_FL;
if (flags & S_NOATIME)
- oi->ip_attr |= OCFS2_NOATIME_FL;
+ oi->ip_attr |= FS_NOATIME_FL;
if (flags & S_DIRSYNC)
- oi->ip_attr |= OCFS2_DIRSYNC_FL;
+ oi->ip_attr |= FS_DIRSYNC_FL;
}

struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno)
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index 27b6192f4b49..a0a28f3d1b7c 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -105,7 +105,7 @@ int ocfs2_fileattr_set(struct mnt_idmap *idmap,
}

if (!S_ISDIR(inode->i_mode))
- flags &= ~OCFS2_DIRSYNC_FL;
+ flags &= ~FS_DIRSYNC_FL;

oldflags = ocfs2_inode->ip_attr;
flags = flags & OCFS2_FL_MODIFIABLE;
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index c501eb3cdcda..b2f6f81a3d28 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -235,30 +235,6 @@
#define OCFS2_INDEXED_DIR_FL (0x0008)
#define OCFS2_HAS_REFCOUNT_FL (0x0010)

-/* Inode attributes, keep in sync with EXT2 */
-#define OCFS2_SECRM_FL FS_SECRM_FL /* Secure deletion */
-#define OCFS2_UNRM_FL FS_UNRM_FL /* Undelete */
-#define OCFS2_COMPR_FL FS_COMPR_FL /* Compress file */
-#define OCFS2_SYNC_FL FS_SYNC_FL /* Synchronous updates */
-#define OCFS2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */
-#define OCFS2_APPEND_FL FS_APPEND_FL /* writes to file may only append */
-#define OCFS2_NODUMP_FL FS_NODUMP_FL /* do not dump file */
-#define OCFS2_NOATIME_FL FS_NOATIME_FL /* do not update atime */
-/* Reserved for compression usage... */
-#define OCFS2_DIRTY_FL FS_DIRTY_FL
-#define OCFS2_COMPRBLK_FL FS_COMPRBLK_FL /* One or more compressed clusters */
-#define OCFS2_NOCOMP_FL FS_NOCOMP_FL /* Don't compress */
-#define OCFS2_ECOMPR_FL FS_ECOMPR_FL /* Compression error */
-/* End compression flags --- maybe not all used */
-#define OCFS2_BTREE_FL FS_BTREE_FL /* btree format dir */
-#define OCFS2_INDEX_FL FS_INDEX_FL /* hash-indexed directory */
-#define OCFS2_IMAGIC_FL FS_IMAGIC_FL /* AFS directory */
-#define OCFS2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL /* Reserved for ext3 */
-#define OCFS2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */
-#define OCFS2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
-#define OCFS2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/
-#define OCFS2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */
-
#define OCFS2_FL_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
#define OCFS2_FL_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */

--
2.55.0