From: Christoph Hellwig <hch@lst.de>
To: Carlos Maiolino <cem@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 12/16] xfs: split out the handlers for XFS_IOC_FSGROWFS_*_32
Date: Wed, 29 Jul 2026 15:03:11 +0200 [thread overview]
Message-ID: <20260729130320.2282183-13-hch@lst.de> (raw)
In-Reply-To: <20260729130320.2282183-1-hch@lst.de>
Split out helpers for XFS_IOC_FSGROWFS_*_32 to keep the stack variables
out of xfs_file_compat_ioctl and to clean up the main compat ioctl
handler flow.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_ioctl32.c | 76 ++++++++++++++++++++++----------------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index 250df2bbf214..2162eda01743 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -44,26 +44,46 @@ xfs_compat_ioc_fsgeometry_v1(
return 0;
}
-STATIC int
-xfs_compat_growfs_data_copyin(
- struct xfs_growfs_data *in,
- compat_xfs_growfs_data_t __user *arg32)
+static int
+xfs_compat_ioc_growfs_data(
+ struct file *file,
+ struct xfs_mount *mp,
+ struct compat_xfs_growfs_data __user *arg32)
{
- if (get_user(in->newblocks, &arg32->newblocks) ||
- get_user(in->imaxpct, &arg32->imaxpct))
+ struct xfs_growfs_data in = { };
+ int error;
+
+ if (get_user(in.newblocks, &arg32->newblocks) ||
+ get_user(in.imaxpct, &arg32->imaxpct))
return -EFAULT;
- return 0;
+
+ error = mnt_want_write_file(file);
+ if (error)
+ return error;
+ error = xfs_growfs_data(mp, &in);
+ mnt_drop_write_file(file);
+ return error;
}
-STATIC int
-xfs_compat_growfs_rt_copyin(
- struct xfs_growfs_rt *in,
- compat_xfs_growfs_rt_t __user *arg32)
+static int
+xfs_compat_ioc_growfs_rt(
+ struct file *file,
+ struct xfs_mount *mp,
+ struct compat_xfs_growfs_rt __user *arg32)
{
- if (get_user(in->newblocks, &arg32->newblocks) ||
- get_user(in->extsize, &arg32->extsize))
+ struct xfs_growfs_rt in = {};
+ int error;
+
+ if (get_user(in.newblocks, &arg32->newblocks) ||
+ get_user(in.extsize, &arg32->extsize))
return -EFAULT;
- return 0;
+
+ error = mnt_want_write_file(file);
+ if (error)
+ return error;
+ error = xfs_growfs_rt(mp, &in);
+ mnt_drop_write_file(file);
+ return error;
}
STATIC int
@@ -434,30 +454,10 @@ xfs_file_compat_ioctl(
#if defined(BROKEN_X86_ALIGNMENT)
case XFS_IOC_FSGEOMETRY_V1_32:
return xfs_compat_ioc_fsgeometry_v1(ip->i_mount, arg);
- case XFS_IOC_FSGROWFSDATA_32: {
- struct xfs_growfs_data in;
-
- if (xfs_compat_growfs_data_copyin(&in, arg))
- return -EFAULT;
- error = mnt_want_write_file(filp);
- if (error)
- return error;
- error = xfs_growfs_data(ip->i_mount, &in);
- mnt_drop_write_file(filp);
- return error;
- }
- case XFS_IOC_FSGROWFSRT_32: {
- struct xfs_growfs_rt in;
-
- if (xfs_compat_growfs_rt_copyin(&in, arg))
- return -EFAULT;
- error = mnt_want_write_file(filp);
- if (error)
- return error;
- error = xfs_growfs_rt(ip->i_mount, &in);
- mnt_drop_write_file(filp);
- return error;
- }
+ case XFS_IOC_FSGROWFSDATA_32:
+ return xfs_compat_ioc_growfs_data(filp, ip->i_mount, arg);
+ case XFS_IOC_FSGROWFSRT_32:
+ return xfs_compat_ioc_growfs_rt(filp, ip->i_mount, arg);
#endif
/* long changes size, but xfs only copiese out 32 bits */
case XFS_IOC_GETVERSION_32:
--
2.53.0
next prev parent reply other threads:[~2026-07-29 13:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 13:02 xfs ioctl handler cleanups Christoph Hellwig
2026-07-29 13:03 ` [PATCH 01/16] xfs: remove an outdated comment above xfs_file_ioctl Christoph Hellwig
2026-07-29 13:03 ` [PATCH 02/16] xfs: rename xfs_ioc_swapext to xfs_swapext Christoph Hellwig
2026-07-29 13:03 ` [PATCH 03/16] xfs: rename xfs_ioctl_fs_counts to xfs_ioc_fs_counts Christoph Hellwig
2026-07-29 13:03 ` [PATCH 04/16] xfs: rename xfs_ioctl_getset_resblocks to xfs_ioc_getset_resblocks Christoph Hellwig
2026-07-29 13:03 ` [PATCH 05/16] xfs: split out the handler for XFS_IOC_DIOINFO Christoph Hellwig
2026-07-29 13:03 ` [PATCH 06/16] xfs: split out the handlers for XFS_IOC_.*HANDLE Christoph Hellwig
2026-07-29 13:03 ` [PATCH 07/16] xfs: split out the handler for XFS_IOC_SWAPEXT Christoph Hellwig
2026-07-29 13:03 ` [PATCH 08/16] xfs: split out the handlers for XFS_IOC_FSGROWFS* Christoph Hellwig
2026-07-29 13:03 ` [PATCH 09/16] xfs: split out the handler for XFS_IOC_GOINGDOWN Christoph Hellwig
2026-07-29 13:03 ` [PATCH 10/16] xfs: split out the handler for XFS_IOC_ERROR_INJECTION Christoph Hellwig
2026-07-29 13:03 ` [PATCH 11/16] xfs: split out the handler for XFS_IOC_FREE_EOFBLOCKS Christoph Hellwig
2026-07-29 13:03 ` Christoph Hellwig [this message]
2026-07-29 13:03 ` [PATCH 13/16] xfs: cleanup XFS_IOC_GETVERSION_32 handling Christoph Hellwig
2026-07-29 13:03 ` [PATCH 14/16] xfs: split out the handlers for XFS_IOC_SWAPEXT_32 Christoph Hellwig
2026-07-29 13:03 ` [PATCH 15/16] xfs: split out the handlers for XFS_IOC_*_BY_HANDLE_32 Christoph Hellwig
2026-07-29 13:03 ` [PATCH 16/16] xfs: remove an extra cast in xfs_file_compat_ioctl Christoph Hellwig
2026-07-29 15:29 ` xfs ioctl handler cleanups Darrick J. Wong
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=20260729130320.2282183-13-hch@lst.de \
--to=hch@lst.de \
--cc=cem@kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox