Skip to contentSkip to conversation

xfs: remove the possibly unused mp variable in xfs_file_compat_ioctl

PATCH In review Christian Brauner 3 participants 5 messages Feb 3, 2021 – Feb 4, 2021 1 message not in the archive XFS filesystem

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): https://lore.kernel.org/linux-xfs/20210203171633.GX7193@magnolia

#1 lore raw

PATCH 1/1 xfs: remove the possibly unused mp variable in xfs_file_compat_ioctl

From: Christoph Hellwig <[email protected]>

The mp variable in xfs_file_compat_ioctl is only used when BROKEN_X86_ALIGNMENT is define. Remove it and just open code the dereference in a few places.

Fixes f736d93d76d3 ("xfs: support idmapped mounts")

---
As mentioned in the thread, I'd take this on top of Christoph's patch if people are ok with this:
https://git.kernel.org/brauner/h/idmapped_mounts

---
 fs/xfs/xfs_ioctl32.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
fs/xfs/xfs_ioctl32.c +3 -4
index 926427b19573..33c09ec8e6c0 100644
@@ -438,7 +438,6 @@ xfs_file_compat_ioctl(
 {
 	struct inode		*inode = file_inode(filp);
 	struct xfs_inode	*ip = XFS_I(inode);
-	struct xfs_mount	*mp = ip->i_mount;
 	void			__user *arg = compat_ptr(p);
 	int			error;
 
@@ -458,7 +457,7 @@ xfs_file_compat_ioctl(
 		return xfs_ioc_space(filp, &bf);
 	}
 	case XFS_IOC_FSGEOMETRY_V1_32:
-		return xfs_compat_ioc_fsgeometry_v1(mp, arg);
+		return xfs_compat_ioc_fsgeometry_v1(ip->i_mount, arg);
 	case XFS_IOC_FSGROWFSDATA_32: {
 		struct xfs_growfs_data	in;
 
@@ -467,7 +466,7 @@ xfs_file_compat_ioctl(
 		error = mnt_want_write_file(filp);
 		if (error)
 			return error;
-		error = xfs_growfs_data(mp, &in);
+		error = xfs_growfs_data(ip->i_mount, &in);
 		mnt_drop_write_file(filp);
 		return error;
 	}
@@ -479,7 +478,7 @@ xfs_file_compat_ioctl(
 		error = mnt_want_write_file(filp);
 		if (error)
 			return error;
-		error = xfs_growfs_rt(mp, &in);
+		error = xfs_growfs_rt(ip->i_mount, &in);
 		mnt_drop_write_file(filp);
 		return error;
 	}

base-commit: f736d93d76d3e97d6986c6d26c8eaa32536ccc5c

Signature · 1 line
2.30.0
Reviewed-by on v1 1/1
#2 lore raw
Quoted 6 lines · Christian Brauner

From: Christoph Hellwig <[email protected]>

The mp variable in xfs_file_compat_ioctl is only used when BROKEN_X86_ALIGNMENT is define. Remove it and just open code the dereference in a few places.

Quoted 7 lines
Fixes f736d93d76d3 ("xfs: support idmapped mounts")

---
As mentioned in the thread, I'd take this on top of Christoph's patch if people are ok with this:
https://git.kernel.org/brauner/h/idmapped_mounts

I don't mind taking this via the xfs tree, unless merging through the idmapped mounts series is easier/causes less rebase mess?

--D

Quoted 48 lines
---
 fs/xfs/xfs_ioctl32.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
fs/xfs/xfs_ioctl32.c +3 -4
index 926427b19573..33c09ec8e6c0 100644
@@ -438,7 +438,6 @@ xfs_file_compat_ioctl(
 {
 	struct inode		*inode = file_inode(filp);
 	struct xfs_inode	*ip = XFS_I(inode);
-	struct xfs_mount	*mp = ip->i_mount;
 	void			__user *arg = compat_ptr(p);
 	int			error;
 
@@ -458,7 +457,7 @@ xfs_file_compat_ioctl(
 		return xfs_ioc_space(filp, &bf);
 	}
 	case XFS_IOC_FSGEOMETRY_V1_32:
-		return xfs_compat_ioc_fsgeometry_v1(mp, arg);
+		return xfs_compat_ioc_fsgeometry_v1(ip->i_mount, arg);
 	case XFS_IOC_FSGROWFSDATA_32: {
 		struct xfs_growfs_data	in;
 
@@ -467,7 +466,7 @@ xfs_file_compat_ioctl(
 		error = mnt_want_write_file(filp);
 		if (error)
 			return error;
-		error = xfs_growfs_data(mp, &in);
+		error = xfs_growfs_data(ip->i_mount, &in);
 		mnt_drop_write_file(filp);
 		return error;
 	}
@@ -479,7 +478,7 @@ xfs_file_compat_ioctl(
 		error = mnt_want_write_file(filp);
 		if (error)
 			return error;
-		error = xfs_growfs_rt(mp, &in);
+		error = xfs_growfs_rt(ip->i_mount, &in);
 		mnt_drop_write_file(filp);
 		return error;
 	}

base-commit: f736d93d76d3e97d6986c6d26c8eaa32536ccc5c

Signature · 1 line
2.30.0
#3 lore raw
Quoted 15 lines · Darrick J. Wong
Quoted 6 lines · Christian Brauner

From: Christoph Hellwig <[email protected]>

The mp variable in xfs_file_compat_ioctl is only used when BROKEN_X86_ALIGNMENT is define. Remove it and just open code the dereference in a few places.

Quoted 7 lines
Fixes f736d93d76d3 ("xfs: support idmapped mounts")

---
As mentioned in the thread, I'd take this on top of Christoph's patch if people are ok with this:
https://git.kernel.org/brauner/h/idmapped_mounts

Quoted 2 lines

I don't mind taking this via the xfs tree, unless merging through the idmapped mounts series is easier/causes less rebase mess?

It's caused by Christoph's xfs conversion patch as he's changing the one place where "mp" was passed outside the BROKEN_X86_ALIGNMENT ifdef to a struct file as arg. So I'd just apply it on top of that if you don't mind. Would make it easier for Stephen Rothwell too as he's dealing with all the merge conflicts. :)

Quoted 2 lines

Tyvm!
Christian

#4 lore raw
Quoted 16 lines · Christian Brauner
Quoted 15 lines · Darrick J. Wong
Quoted 13 lines · Christian Brauner

From: Christoph Hellwig <[email protected]>

The mp variable in xfs_file_compat_ioctl is only used when BROKEN_X86_ALIGNMENT is define. Remove it and just open code the dereference in a few places.

Fixes f736d93d76d3 ("xfs: support idmapped mounts")

---
As mentioned in the thread, I'd take this on top of Christoph's patch if people are ok with this:
https://git.kernel.org/brauner/h/idmapped_mounts

Quoted 8 lines
Quoted 2 lines

I don't mind taking this via the xfs tree, unless merging through the idmapped mounts series is easier/causes less rebase mess?

It's caused by Christoph's xfs conversion patch as he's changing the one place where "mp" was passed outside the BROKEN_X86_ALIGNMENT ifdef to a struct file as arg. So I'd just apply it on top of that if you don't mind. Would make it easier for Stephen Rothwell too as he's dealing with all the merge conflicts. :)

Works for me; I'm 100% ok with it going through your tree. :)

--D

Quoted 6 lines
Quoted 3 lines

Tyvm!
Christian

Tested-by on v1 1/1
#5 lore raw
In reply to Christian Brauner

It works on arm64 platform, so,

Thanks,
Shaokun

Quoted 59 lines · Christian Brauner

From: Christoph Hellwig <[email protected]>

The mp variable in xfs_file_compat_ioctl is only used when BROKEN_X86_ALIGNMENT is define. Remove it and just open code the dereference in a few places.

Fixes f736d93d76d3 ("xfs: support idmapped mounts")

---
As mentioned in the thread, I'd take this on top of Christoph's patch if people are ok with this:
https://git.kernel.org/brauner/h/idmapped_mounts

---
 fs/xfs/xfs_ioctl32.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
fs/xfs/xfs_ioctl32.c +3 -4
index 926427b19573..33c09ec8e6c0 100644
@@ -438,7 +438,6 @@ xfs_file_compat_ioctl(
 {
 	struct inode		*inode = file_inode(filp);
 	struct xfs_inode	*ip = XFS_I(inode);
-	struct xfs_mount	*mp = ip->i_mount;
 	void			__user *arg = compat_ptr(p);
 	int			error;
 
@@ -458,7 +457,7 @@ xfs_file_compat_ioctl(
 		return xfs_ioc_space(filp, &bf);
 	}
 	case XFS_IOC_FSGEOMETRY_V1_32:
-		return xfs_compat_ioc_fsgeometry_v1(mp, arg);
+		return xfs_compat_ioc_fsgeometry_v1(ip->i_mount, arg);
 	case XFS_IOC_FSGROWFSDATA_32: {
 		struct xfs_growfs_data	in;
 
@@ -467,7 +466,7 @@ xfs_file_compat_ioctl(
 		error = mnt_want_write_file(filp);
 		if (error)
 			return error;
-		error = xfs_growfs_data(mp, &in);
+		error = xfs_growfs_data(ip->i_mount, &in);
 		mnt_drop_write_file(filp);
 		return error;
 	}
@@ -479,7 +478,7 @@ xfs_file_compat_ioctl(
 		error = mnt_want_write_file(filp);
 		if (error)
 			return error;
-		error = xfs_growfs_rt(mp, &in);
+		error = xfs_growfs_rt(ip->i_mount, &in);
 		mnt_drop_write_file(filp);
 		return error;
 	}

base-commit: f736d93d76d3e97d6986c6d26c8eaa32536ccc5c