xfs: move xfs_ioc_scrub_metadata to scrub.c
Move the scrub ioctl handler to scrub.c to keep the code together and to reduce unnecessary code when CONFIG_XFS_ONLINE_SCRUB=n. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
+26
-1
@@ -578,7 +578,7 @@ xchk_scrub_create_subord(
|
||||
}
|
||||
|
||||
/* Dispatch metadata scrubbing. */
|
||||
int
|
||||
STATIC int
|
||||
xfs_scrub_metadata(
|
||||
struct file *file,
|
||||
struct xfs_scrub_metadata *sm)
|
||||
@@ -724,3 +724,28 @@ try_harder:
|
||||
run.retries++;
|
||||
goto retry_op;
|
||||
}
|
||||
|
||||
/* Scrub one aspect of one piece of metadata. */
|
||||
int
|
||||
xfs_ioc_scrub_metadata(
|
||||
struct file *file,
|
||||
void __user *arg)
|
||||
{
|
||||
struct xfs_scrub_metadata scrub;
|
||||
int error;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (copy_from_user(&scrub, arg, sizeof(scrub)))
|
||||
return -EFAULT;
|
||||
|
||||
error = xfs_scrub_metadata(file, &scrub);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (copy_to_user(arg, &scrub, sizeof(scrub)))
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#define __XFS_SCRUB_H__
|
||||
|
||||
#ifndef CONFIG_XFS_ONLINE_SCRUB
|
||||
# define xfs_scrub_metadata(file, sm) (-ENOTTY)
|
||||
# define xfs_ioc_scrub_metadata(f, a) (-ENOTTY)
|
||||
#else
|
||||
int xfs_scrub_metadata(struct file *file, struct xfs_scrub_metadata *sm);
|
||||
int xfs_ioc_scrub_metadata(struct file *file, void __user *arg);
|
||||
#endif /* CONFIG_XFS_ONLINE_SCRUB */
|
||||
|
||||
#endif /* __XFS_SCRUB_H__ */
|
||||
|
||||
@@ -1055,30 +1055,6 @@ out_free:
|
||||
return error;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_scrub_metadata(
|
||||
struct file *file,
|
||||
void __user *arg)
|
||||
{
|
||||
struct xfs_scrub_metadata scrub;
|
||||
int error;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (copy_from_user(&scrub, arg, sizeof(scrub)))
|
||||
return -EFAULT;
|
||||
|
||||
error = xfs_scrub_metadata(file, &scrub);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (copy_to_user(arg, &scrub, sizeof(scrub)))
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
xfs_ioc_swapext(
|
||||
xfs_swapext_t *sxp)
|
||||
|
||||
Reference in New Issue
Block a user