Skip to content

Commit be7cf17

Browse files
author
Darrick J. Wong
committed
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 <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 271557d commit be7cf17

File tree

3 files changed

+28
-27
lines changed

3 files changed

+28
-27
lines changed

fs/xfs/scrub/scrub.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ xchk_scrub_create_subord(
578578
}
579579

580580
/* Dispatch metadata scrubbing. */
581-
int
581+
STATIC int
582582
xfs_scrub_metadata(
583583
struct file *file,
584584
struct xfs_scrub_metadata *sm)
@@ -724,3 +724,28 @@ xfs_scrub_metadata(
724724
run.retries++;
725725
goto retry_op;
726726
}
727+
728+
/* Scrub one aspect of one piece of metadata. */
729+
int
730+
xfs_ioc_scrub_metadata(
731+
struct file *file,
732+
void __user *arg)
733+
{
734+
struct xfs_scrub_metadata scrub;
735+
int error;
736+
737+
if (!capable(CAP_SYS_ADMIN))
738+
return -EPERM;
739+
740+
if (copy_from_user(&scrub, arg, sizeof(scrub)))
741+
return -EFAULT;
742+
743+
error = xfs_scrub_metadata(file, &scrub);
744+
if (error)
745+
return error;
746+
747+
if (copy_to_user(arg, &scrub, sizeof(scrub)))
748+
return -EFAULT;
749+
750+
return 0;
751+
}

fs/xfs/scrub/xfs_scrub.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#define __XFS_SCRUB_H__
88

99
#ifndef CONFIG_XFS_ONLINE_SCRUB
10-
# define xfs_scrub_metadata(file, sm) (-ENOTTY)
10+
# define xfs_ioc_scrub_metadata(f, a) (-ENOTTY)
1111
#else
12-
int xfs_scrub_metadata(struct file *file, struct xfs_scrub_metadata *sm);
12+
int xfs_ioc_scrub_metadata(struct file *file, void __user *arg);
1313
#endif /* CONFIG_XFS_ONLINE_SCRUB */
1414

1515
#endif /* __XFS_SCRUB_H__ */

fs/xfs/xfs_ioctl.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,30 +1055,6 @@ xfs_ioc_getfsmap(
10551055
return error;
10561056
}
10571057

1058-
STATIC int
1059-
xfs_ioc_scrub_metadata(
1060-
struct file *file,
1061-
void __user *arg)
1062-
{
1063-
struct xfs_scrub_metadata scrub;
1064-
int error;
1065-
1066-
if (!capable(CAP_SYS_ADMIN))
1067-
return -EPERM;
1068-
1069-
if (copy_from_user(&scrub, arg, sizeof(scrub)))
1070-
return -EFAULT;
1071-
1072-
error = xfs_scrub_metadata(file, &scrub);
1073-
if (error)
1074-
return error;
1075-
1076-
if (copy_to_user(arg, &scrub, sizeof(scrub)))
1077-
return -EFAULT;
1078-
1079-
return 0;
1080-
}
1081-
10821058
int
10831059
xfs_ioc_swapext(
10841060
xfs_swapext_t *sxp)

0 commit comments

Comments
 (0)