summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_ioctl.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-04-12 07:41:17 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2019-04-14 18:15:57 -0700
commit7cd5006bdb6f6d9d9d7e68aa1d96b6e4a8b68bc5 (patch)
treedf47e1074e3c043f5206a0e6c0201ae421fc0462 /fs/xfs/xfs_ioctl.c
parent1b6d968de22bffd85a60538d2628185b17228291 (diff)
downloadlinux-7cd5006bdb6f6d9d9d7e68aa1d96b6e4a8b68bc5.tar.bz2
xfs: add a new ioctl to describe allocation group geometry
Add a new ioctl to describe an allocation group's geometry. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_ioctl.c')
-rw-r--r--fs/xfs/xfs_ioctl.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index ec3c6c401ee7..b36abd453709 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -33,6 +33,7 @@
#include "xfs_fsmap.h"
#include "scrub/xfs_scrub.h"
#include "xfs_sb.h"
+#include "xfs_ag.h"
#include <linux/capability.h>
#include <linux/cred.h>
@@ -804,6 +805,26 @@ xfs_ioc_fsgeometry(
return 0;
}
+STATIC int
+xfs_ioc_ag_geometry(
+ struct xfs_mount *mp,
+ void __user *arg)
+{
+ struct xfs_ag_geometry ageo;
+ int error;
+
+ if (copy_from_user(&ageo, arg, sizeof(ageo)))
+ return -EFAULT;
+
+ error = xfs_ag_get_geometry(mp, ageo.ag_number, &ageo);
+ if (error)
+ return error;
+
+ if (copy_to_user(arg, &ageo, sizeof(ageo)))
+ return -EFAULT;
+ return 0;
+}
+
/*
* Linux extended inode flags interface.
*/
@@ -1930,6 +1951,9 @@ xfs_file_ioctl(
case XFS_IOC_FSGEOMETRY:
return xfs_ioc_fsgeometry(mp, arg, 5);
+ case XFS_IOC_AG_GEOMETRY:
+ return xfs_ioc_ag_geometry(mp, arg);
+
case XFS_IOC_GETVERSION:
return put_user(inode->i_generation, (int __user *)arg);