mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ocfs2: clean up falloc and inode flag definitions
@ 2026-10-22 13:04 Anthony Iliopoulos
  2026-10-22 13:04 ` [PATCH v2 1/2] ocfs2: replace ocfs2-specific falloc ioctls with generic ones Anthony Iliopoulos
  2026-10-22 13:04 ` [PATCH v2 2/2] ocfs2: replace ocfs2-specific inode flags " Anthony Iliopoulos
  0 siblings, 2 replies; 5+ messages in thread
From: Anthony Iliopoulos @ 2026-10-22 13:04 UTC (permalink / raw)
  To: Mark Fasheh, Joel Becker, Joseph Qi; +Cc: ocfs2-devel, linux-kernel

This short series cleans up and replaces redundant ocfs2-specific falloc
ioctl and inode flag definitions in favor of generic ones.

v2:
- repost as series
- replace previously omitted OCFS2_FL_{MODIFIABLE,VISIBLE}

Anthony Iliopoulos (2):
  ocfs2: replace ocfs2-specific falloc ioctls with generic ones
  ocfs2: replace ocfs2-specific inode flags with generic ones

 fs/ocfs2/file.c        | 26 +++++++++++++-------------
 fs/ocfs2/file.h        |  4 +++-
 fs/ocfs2/inode.c       | 24 ++++++++++++------------
 fs/ocfs2/ioctl.c       | 27 ++++++++++++++-------------
 fs/ocfs2/ocfs2_fs.h    | 27 ---------------------------
 fs/ocfs2/ocfs2_ioctl.h | 26 --------------------------
 6 files changed, 42 insertions(+), 92 deletions(-)

-- 
2.56.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] ocfs2: replace ocfs2-specific falloc ioctls with generic ones
  2026-10-22 13:04 [PATCH v2 0/2] ocfs2: clean up falloc and inode flag definitions Anthony Iliopoulos
@ 2026-10-22 13:04 ` Anthony Iliopoulos
  2026-10-24 16:25   ` Joseph Qi
  2026-10-22 13:04 ` [PATCH v2 2/2] ocfs2: replace ocfs2-specific inode flags " Anthony Iliopoulos
  1 sibling, 1 reply; 5+ messages in thread
From: Anthony Iliopoulos @ 2026-10-22 13:04 UTC (permalink / raw)
  To: Mark Fasheh, Joel Becker, Joseph Qi; +Cc: ocfs2-devel, linux-kernel

Replace custom ocfs2 space reservation structures and ioctl definitions
with the generic file space allocation interfaces.

Those were originally copied from xfs in commit b25801038da5 ("ocfs2:
Support xfs style space reservation ioctls") for compatibility reasons,
which were eventually lifted to vfs and made generic. As such there is
no reason to carry around the redundant definitions any longer, they can
be dropped at this point.

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
---
 fs/ocfs2/file.c        | 26 +++++++++++++-------------
 fs/ocfs2/file.h        |  4 +++-
 fs/ocfs2/ioctl.c       | 19 ++++++++++---------
 fs/ocfs2/ocfs2_ioctl.h | 26 --------------------------
 4 files changed, 26 insertions(+), 49 deletions(-)

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 62f45a1b5ca1..5ccc2a613e2d 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1944,7 +1944,7 @@ int ocfs2_remove_inode_range(struct inode *inode,
  */
 static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
 				     loff_t f_pos, unsigned int cmd,
-				     struct ocfs2_space_resv *sr,
+				     struct space_resv *sr,
 				     int change_size)
 {
 	int ret;
@@ -2008,8 +2008,8 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
 	}
 	size = sr->l_start + sr->l_len;
 
-	if (cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64 ||
-	    cmd == OCFS2_IOC_UNRESVSP || cmd == OCFS2_IOC_UNRESVSP64) {
+	if (cmd == FS_IOC_RESVSP || cmd == FS_IOC_RESVSP64 ||
+	    cmd == FS_IOC_UNRESVSP || cmd == FS_IOC_UNRESVSP64) {
 		if (sr->l_len <= 0) {
 			ret = -EINVAL;
 			goto out_inode_unlock;
@@ -2026,8 +2026,8 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
 
 	down_write(&OCFS2_I(inode)->ip_alloc_sem);
 	switch (cmd) {
-	case OCFS2_IOC_RESVSP:
-	case OCFS2_IOC_RESVSP64:
+	case FS_IOC_RESVSP:
+	case FS_IOC_RESVSP64:
 		/*
 		 * This takes unsigned offsets, but the signed ones we
 		 * pass have been checked against overflow above.
@@ -2035,8 +2035,8 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
 		ret = ocfs2_allocate_unwritten_extents(inode, sr->l_start,
 						       sr->l_len);
 		break;
-	case OCFS2_IOC_UNRESVSP:
-	case OCFS2_IOC_UNRESVSP64:
+	case FS_IOC_UNRESVSP:
+	case FS_IOC_UNRESVSP64:
 		ret = ocfs2_remove_inode_range(inode, di_bh, sr->l_start,
 					       sr->l_len);
 		break;
@@ -2090,16 +2090,16 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
 }
 
 int ocfs2_change_file_space(struct file *file, unsigned int cmd,
-			    struct ocfs2_space_resv *sr)
+			    struct space_resv *sr)
 {
 	struct inode *inode = file_inode(file);
 	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 	int ret;
 
-	if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) &&
+	if ((cmd == FS_IOC_RESVSP || cmd == FS_IOC_RESVSP64) &&
 	    !ocfs2_writes_unwritten_extents(osb))
 		return -ENOTTY;
-	else if ((cmd == OCFS2_IOC_UNRESVSP || cmd == OCFS2_IOC_UNRESVSP64) &&
+	else if ((cmd == FS_IOC_UNRESVSP || cmd == FS_IOC_UNRESVSP64) &&
 		 !ocfs2_sparse_alloc(osb))
 		return -ENOTTY;
 
@@ -2122,9 +2122,9 @@ static long ocfs2_fallocate(struct file *file, int mode, loff_t offset,
 {
 	struct inode *inode = file_inode(file);
 	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
-	struct ocfs2_space_resv sr;
+	struct space_resv sr;
 	int change_size = 1;
-	int cmd = OCFS2_IOC_RESVSP64;
+	int cmd = FS_IOC_RESVSP64;
 	int ret = 0;
 
 	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
@@ -2141,7 +2141,7 @@ static long ocfs2_fallocate(struct file *file, int mode, loff_t offset,
 	}
 
 	if (mode & FALLOC_FL_PUNCH_HOLE)
-		cmd = OCFS2_IOC_UNRESVSP64;
+		cmd = FS_IOC_UNRESVSP64;
 
 	sr.l_whence = 0;
 	sr.l_start = (s64)offset;
diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h
index 97492ee5789e..7f587dc06dab 100644
--- a/fs/ocfs2/file.h
+++ b/fs/ocfs2/file.h
@@ -10,6 +10,8 @@
 #ifndef OCFS2_FILE_H
 #define OCFS2_FILE_H
 
+#include <linux/falloc.h>
+
 extern const struct file_operations ocfs2_fops;
 extern const struct file_operations ocfs2_dops;
 extern const struct file_operations ocfs2_fops_no_plocks;
@@ -64,7 +66,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
 			     struct buffer_head *bh);
 
 int ocfs2_change_file_space(struct file *file, unsigned int cmd,
-			    struct ocfs2_space_resv *sr);
+			    struct space_resv *sr);
 
 int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos,
 				   size_t count);
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index 36c7c9ac8b5d..2d95c1e5ad8b 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -11,6 +11,7 @@
 #include <linux/blkdev.h>
 #include <linux/compat.h>
 #include <linux/fileattr.h>
+#include <linux/falloc.h>
 
 #include <cluster/masklog.h>
 
@@ -857,12 +858,12 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 	int status;
 
 	switch (cmd) {
-	case OCFS2_IOC_RESVSP:
-	case OCFS2_IOC_RESVSP64:
-	case OCFS2_IOC_UNRESVSP:
-	case OCFS2_IOC_UNRESVSP64:
+	case FS_IOC_RESVSP:
+	case FS_IOC_RESVSP64:
+	case FS_IOC_UNRESVSP:
+	case FS_IOC_UNRESVSP64:
 	{
-		struct ocfs2_space_resv sr;
+		struct space_resv sr;
 
 		if (copy_from_user(&sr, (int __user *) arg, sizeof(sr)))
 			return -EFAULT;
@@ -971,10 +972,10 @@ long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
 	void __user *argp = (void __user *)arg;
 
 	switch (cmd) {
-	case OCFS2_IOC_RESVSP:
-	case OCFS2_IOC_RESVSP64:
-	case OCFS2_IOC_UNRESVSP:
-	case OCFS2_IOC_UNRESVSP64:
+	case FS_IOC_RESVSP:
+	case FS_IOC_RESVSP64:
+	case FS_IOC_UNRESVSP:
+	case FS_IOC_UNRESVSP64:
 	case OCFS2_IOC_GROUP_EXTEND:
 	case OCFS2_IOC_GROUP_ADD:
 	case OCFS2_IOC_GROUP_ADD64:
diff --git a/fs/ocfs2/ocfs2_ioctl.h b/fs/ocfs2/ocfs2_ioctl.h
index 2de2f8733283..30244c94239b 100644
--- a/fs/ocfs2/ocfs2_ioctl.h
+++ b/fs/ocfs2/ocfs2_ioctl.h
@@ -10,32 +10,6 @@
 #ifndef OCFS2_IOCTL_H
 #define OCFS2_IOCTL_H
 
-/*
- * Space reservation / allocation / free ioctls and argument structure
- * are designed to be compatible with XFS.
- *
- * ALLOCSP* and FREESP* are not and will never be supported, but are
- * included here for completeness.
- */
-struct ocfs2_space_resv {
-	__s16		l_type;
-	__s16		l_whence;
-	__s64		l_start;
-	__s64		l_len;		/* len == 0 means until end of file */
-	__s32		l_sysid;
-	__u32		l_pid;
-	__s32		l_pad[4];	/* reserve area			    */
-};
-
-#define OCFS2_IOC_ALLOCSP		_IOW ('X', 10, struct ocfs2_space_resv)
-#define OCFS2_IOC_FREESP		_IOW ('X', 11, struct ocfs2_space_resv)
-#define OCFS2_IOC_RESVSP		_IOW ('X', 40, struct ocfs2_space_resv)
-#define OCFS2_IOC_UNRESVSP	_IOW ('X', 41, struct ocfs2_space_resv)
-#define OCFS2_IOC_ALLOCSP64	_IOW ('X', 36, struct ocfs2_space_resv)
-#define OCFS2_IOC_FREESP64	_IOW ('X', 37, struct ocfs2_space_resv)
-#define OCFS2_IOC_RESVSP64	_IOW ('X', 42, struct ocfs2_space_resv)
-#define OCFS2_IOC_UNRESVSP64	_IOW ('X', 43, struct ocfs2_space_resv)
-
 /* Used to pass group descriptor data when online resize is done */
 struct ocfs2_new_group_input {
 	__u64 group;		/* Group descriptor's blkno. */
-- 
2.56.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] ocfs2: replace ocfs2-specific inode flags with generic ones
  2026-10-22 13:04 [PATCH v2 0/2] ocfs2: clean up falloc and inode flag definitions Anthony Iliopoulos
  2026-10-22 13:04 ` [PATCH v2 1/2] ocfs2: replace ocfs2-specific falloc ioctls with generic ones Anthony Iliopoulos
@ 2026-10-22 13:04 ` Anthony Iliopoulos
  2026-10-24 16:26   ` Joseph Qi
  1 sibling, 1 reply; 5+ messages in thread
From: Anthony Iliopoulos @ 2026-10-22 13:04 UTC (permalink / raw)
  To: Mark Fasheh, Joel Becker, Joseph Qi; +Cc: ocfs2-devel, linux-kernel

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@suse.com>
---
 fs/ocfs2/inode.c    | 24 ++++++++++++------------
 fs/ocfs2/ioctl.c    |  8 ++++----
 fs/ocfs2/ocfs2_fs.h | 27 ---------------------------
 3 files changed, 16 insertions(+), 43 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 2d95c1e5ad8b..2d962da9ba5c 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -78,7 +78,7 @@ int ocfs2_fileattr_get(struct dentry *dentry, struct file_kattr *fa)
 	flags = OCFS2_I(inode)->ip_attr;
 	ocfs2_inode_unlock(inode, 0);
 
-	fileattr_fill_flags(fa, flags & OCFS2_FL_VISIBLE);
+	fileattr_fill_flags(fa, flags & FS_FL_USER_VISIBLE);
 
 	return status;
 }
@@ -105,11 +105,11 @@ int ocfs2_fileattr_set(const 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;
-	flags |= oldflags & ~OCFS2_FL_MODIFIABLE;
+	flags = flags & FS_FL_USER_MODIFIABLE;
+	flags |= oldflags & ~FS_FL_USER_MODIFIABLE;
 
 	/* Check already done by VFS, but repeat with ocfs lock */
 	status = -EPERM;
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index c501eb3cdcda..53ddeb5e762f 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -235,33 +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 */
-
 /*
  * Extent record flags (e_node.leaf.flags)
  */
-- 
2.56.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] ocfs2: replace ocfs2-specific falloc ioctls with generic ones
  2026-10-22 13:04 ` [PATCH v2 1/2] ocfs2: replace ocfs2-specific falloc ioctls with generic ones Anthony Iliopoulos
@ 2026-10-24 16:25   ` Joseph Qi
  0 siblings, 0 replies; 5+ messages in thread
From: Joseph Qi @ 2026-10-24 16:25 UTC (permalink / raw)
  To: Anthony Iliopoulos, Andrew Morton
  Cc: Mark Fasheh, Joel Becker, ocfs2-devel, linux-kernel



On 10/22/26 9:04 PM, Anthony Iliopoulos wrote:
> Replace custom ocfs2 space reservation structures and ioctl definitions
> with the generic file space allocation interfaces.
> 
> Those were originally copied from xfs in commit b25801038da5 ("ocfs2:
> Support xfs style space reservation ioctls") for compatibility reasons,
> which were eventually lifted to vfs and made generic. As such there is
> no reason to carry around the redundant definitions any longer, they can
> be dropped at this point.
> 
> Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>

Looks fine.
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>

> ---
>  fs/ocfs2/file.c        | 26 +++++++++++++-------------
>  fs/ocfs2/file.h        |  4 +++-
>  fs/ocfs2/ioctl.c       | 19 ++++++++++---------
>  fs/ocfs2/ocfs2_ioctl.h | 26 --------------------------
>  4 files changed, 26 insertions(+), 49 deletions(-)
> 
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index 62f45a1b5ca1..5ccc2a613e2d 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -1944,7 +1944,7 @@ int ocfs2_remove_inode_range(struct inode *inode,
>   */
>  static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
>  				     loff_t f_pos, unsigned int cmd,
> -				     struct ocfs2_space_resv *sr,
> +				     struct space_resv *sr,
>  				     int change_size)
>  {
>  	int ret;
> @@ -2008,8 +2008,8 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
>  	}
>  	size = sr->l_start + sr->l_len;
>  
> -	if (cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64 ||
> -	    cmd == OCFS2_IOC_UNRESVSP || cmd == OCFS2_IOC_UNRESVSP64) {
> +	if (cmd == FS_IOC_RESVSP || cmd == FS_IOC_RESVSP64 ||
> +	    cmd == FS_IOC_UNRESVSP || cmd == FS_IOC_UNRESVSP64) {
>  		if (sr->l_len <= 0) {
>  			ret = -EINVAL;
>  			goto out_inode_unlock;
> @@ -2026,8 +2026,8 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
>  
>  	down_write(&OCFS2_I(inode)->ip_alloc_sem);
>  	switch (cmd) {
> -	case OCFS2_IOC_RESVSP:
> -	case OCFS2_IOC_RESVSP64:
> +	case FS_IOC_RESVSP:
> +	case FS_IOC_RESVSP64:
>  		/*
>  		 * This takes unsigned offsets, but the signed ones we
>  		 * pass have been checked against overflow above.
> @@ -2035,8 +2035,8 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
>  		ret = ocfs2_allocate_unwritten_extents(inode, sr->l_start,
>  						       sr->l_len);
>  		break;
> -	case OCFS2_IOC_UNRESVSP:
> -	case OCFS2_IOC_UNRESVSP64:
> +	case FS_IOC_UNRESVSP:
> +	case FS_IOC_UNRESVSP64:
>  		ret = ocfs2_remove_inode_range(inode, di_bh, sr->l_start,
>  					       sr->l_len);
>  		break;
> @@ -2090,16 +2090,16 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
>  }
>  
>  int ocfs2_change_file_space(struct file *file, unsigned int cmd,
> -			    struct ocfs2_space_resv *sr)
> +			    struct space_resv *sr)
>  {
>  	struct inode *inode = file_inode(file);
>  	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
>  	int ret;
>  
> -	if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) &&
> +	if ((cmd == FS_IOC_RESVSP || cmd == FS_IOC_RESVSP64) &&
>  	    !ocfs2_writes_unwritten_extents(osb))
>  		return -ENOTTY;
> -	else if ((cmd == OCFS2_IOC_UNRESVSP || cmd == OCFS2_IOC_UNRESVSP64) &&
> +	else if ((cmd == FS_IOC_UNRESVSP || cmd == FS_IOC_UNRESVSP64) &&
>  		 !ocfs2_sparse_alloc(osb))
>  		return -ENOTTY;
>  
> @@ -2122,9 +2122,9 @@ static long ocfs2_fallocate(struct file *file, int mode, loff_t offset,
>  {
>  	struct inode *inode = file_inode(file);
>  	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
> -	struct ocfs2_space_resv sr;
> +	struct space_resv sr;
>  	int change_size = 1;
> -	int cmd = OCFS2_IOC_RESVSP64;
> +	int cmd = FS_IOC_RESVSP64;
>  	int ret = 0;
>  
>  	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
> @@ -2141,7 +2141,7 @@ static long ocfs2_fallocate(struct file *file, int mode, loff_t offset,
>  	}
>  
>  	if (mode & FALLOC_FL_PUNCH_HOLE)
> -		cmd = OCFS2_IOC_UNRESVSP64;
> +		cmd = FS_IOC_UNRESVSP64;
>  
>  	sr.l_whence = 0;
>  	sr.l_start = (s64)offset;
> diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h
> index 97492ee5789e..7f587dc06dab 100644
> --- a/fs/ocfs2/file.h
> +++ b/fs/ocfs2/file.h
> @@ -10,6 +10,8 @@
>  #ifndef OCFS2_FILE_H
>  #define OCFS2_FILE_H
>  
> +#include <linux/falloc.h>
> +
>  extern const struct file_operations ocfs2_fops;
>  extern const struct file_operations ocfs2_dops;
>  extern const struct file_operations ocfs2_fops_no_plocks;
> @@ -64,7 +66,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
>  			     struct buffer_head *bh);
>  
>  int ocfs2_change_file_space(struct file *file, unsigned int cmd,
> -			    struct ocfs2_space_resv *sr);
> +			    struct space_resv *sr);
>  
>  int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos,
>  				   size_t count);
> diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
> index 36c7c9ac8b5d..2d95c1e5ad8b 100644
> --- a/fs/ocfs2/ioctl.c
> +++ b/fs/ocfs2/ioctl.c
> @@ -11,6 +11,7 @@
>  #include <linux/blkdev.h>
>  #include <linux/compat.h>
>  #include <linux/fileattr.h>
> +#include <linux/falloc.h>
>  
>  #include <cluster/masklog.h>
>  
> @@ -857,12 +858,12 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>  	int status;
>  
>  	switch (cmd) {
> -	case OCFS2_IOC_RESVSP:
> -	case OCFS2_IOC_RESVSP64:
> -	case OCFS2_IOC_UNRESVSP:
> -	case OCFS2_IOC_UNRESVSP64:
> +	case FS_IOC_RESVSP:
> +	case FS_IOC_RESVSP64:
> +	case FS_IOC_UNRESVSP:
> +	case FS_IOC_UNRESVSP64:
>  	{
> -		struct ocfs2_space_resv sr;
> +		struct space_resv sr;
>  
>  		if (copy_from_user(&sr, (int __user *) arg, sizeof(sr)))
>  			return -EFAULT;
> @@ -971,10 +972,10 @@ long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
>  	void __user *argp = (void __user *)arg;
>  
>  	switch (cmd) {
> -	case OCFS2_IOC_RESVSP:
> -	case OCFS2_IOC_RESVSP64:
> -	case OCFS2_IOC_UNRESVSP:
> -	case OCFS2_IOC_UNRESVSP64:
> +	case FS_IOC_RESVSP:
> +	case FS_IOC_RESVSP64:
> +	case FS_IOC_UNRESVSP:
> +	case FS_IOC_UNRESVSP64:
>  	case OCFS2_IOC_GROUP_EXTEND:
>  	case OCFS2_IOC_GROUP_ADD:
>  	case OCFS2_IOC_GROUP_ADD64:
> diff --git a/fs/ocfs2/ocfs2_ioctl.h b/fs/ocfs2/ocfs2_ioctl.h
> index 2de2f8733283..30244c94239b 100644
> --- a/fs/ocfs2/ocfs2_ioctl.h
> +++ b/fs/ocfs2/ocfs2_ioctl.h
> @@ -10,32 +10,6 @@
>  #ifndef OCFS2_IOCTL_H
>  #define OCFS2_IOCTL_H
>  
> -/*
> - * Space reservation / allocation / free ioctls and argument structure
> - * are designed to be compatible with XFS.
> - *
> - * ALLOCSP* and FREESP* are not and will never be supported, but are
> - * included here for completeness.
> - */
> -struct ocfs2_space_resv {
> -	__s16		l_type;
> -	__s16		l_whence;
> -	__s64		l_start;
> -	__s64		l_len;		/* len == 0 means until end of file */
> -	__s32		l_sysid;
> -	__u32		l_pid;
> -	__s32		l_pad[4];	/* reserve area			    */
> -};
> -
> -#define OCFS2_IOC_ALLOCSP		_IOW ('X', 10, struct ocfs2_space_resv)
> -#define OCFS2_IOC_FREESP		_IOW ('X', 11, struct ocfs2_space_resv)
> -#define OCFS2_IOC_RESVSP		_IOW ('X', 40, struct ocfs2_space_resv)
> -#define OCFS2_IOC_UNRESVSP	_IOW ('X', 41, struct ocfs2_space_resv)
> -#define OCFS2_IOC_ALLOCSP64	_IOW ('X', 36, struct ocfs2_space_resv)
> -#define OCFS2_IOC_FREESP64	_IOW ('X', 37, struct ocfs2_space_resv)
> -#define OCFS2_IOC_RESVSP64	_IOW ('X', 42, struct ocfs2_space_resv)
> -#define OCFS2_IOC_UNRESVSP64	_IOW ('X', 43, struct ocfs2_space_resv)
> -
>  /* Used to pass group descriptor data when online resize is done */
>  struct ocfs2_new_group_input {
>  	__u64 group;		/* Group descriptor's blkno. */


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] ocfs2: replace ocfs2-specific inode flags with generic ones
  2026-10-22 13:04 ` [PATCH v2 2/2] ocfs2: replace ocfs2-specific inode flags " Anthony Iliopoulos
@ 2026-10-24 16:26   ` Joseph Qi
  0 siblings, 0 replies; 5+ messages in thread
From: Joseph Qi @ 2026-10-24 16:26 UTC (permalink / raw)
  To: Anthony Iliopoulos, Andrew Morton
  Cc: Mark Fasheh, Joel Becker, ocfs2-devel, linux-kernel



On 10/22/26 9:04 PM, Anthony Iliopoulos wrote:
> 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@suse.com>

Looks fine.
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>

> ---
>  fs/ocfs2/inode.c    | 24 ++++++++++++------------
>  fs/ocfs2/ioctl.c    |  8 ++++----
>  fs/ocfs2/ocfs2_fs.h | 27 ---------------------------
>  3 files changed, 16 insertions(+), 43 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 2d95c1e5ad8b..2d962da9ba5c 100644
> --- a/fs/ocfs2/ioctl.c
> +++ b/fs/ocfs2/ioctl.c
> @@ -78,7 +78,7 @@ int ocfs2_fileattr_get(struct dentry *dentry, struct file_kattr *fa)
>  	flags = OCFS2_I(inode)->ip_attr;
>  	ocfs2_inode_unlock(inode, 0);
>  
> -	fileattr_fill_flags(fa, flags & OCFS2_FL_VISIBLE);
> +	fileattr_fill_flags(fa, flags & FS_FL_USER_VISIBLE);
>  
>  	return status;
>  }
> @@ -105,11 +105,11 @@ int ocfs2_fileattr_set(const 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;
> -	flags |= oldflags & ~OCFS2_FL_MODIFIABLE;
> +	flags = flags & FS_FL_USER_MODIFIABLE;
> +	flags |= oldflags & ~FS_FL_USER_MODIFIABLE;
>  
>  	/* Check already done by VFS, but repeat with ocfs lock */
>  	status = -EPERM;
> diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
> index c501eb3cdcda..53ddeb5e762f 100644
> --- a/fs/ocfs2/ocfs2_fs.h
> +++ b/fs/ocfs2/ocfs2_fs.h
> @@ -235,33 +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 */
> -
>  /*
>   * Extent record flags (e_node.leaf.flags)
>   */


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-24 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 13:04 [PATCH v2 0/2] ocfs2: clean up falloc and inode flag definitions Anthony Iliopoulos
2026-10-22 13:04 ` [PATCH v2 1/2] ocfs2: replace ocfs2-specific falloc ioctls with generic ones Anthony Iliopoulos
2026-10-24 16:25   ` Joseph Qi
2026-10-22 13:04 ` [PATCH v2 2/2] ocfs2: replace ocfs2-specific inode flags " Anthony Iliopoulos
2026-10-24 16:26   ` Joseph Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®