xfs: probe the scrub ioctl

Create a probe scrubber with id 0.  This will be used by xfs_scrub to
probe the kernel's abilities to scrub (and repair) the metadata.  We do
this by validating the ioctl inputs from userspace, preparing the
filesystem for a scrub (or a repair) operation, and immediately
returning to userspace.  Userspace can use the returned errno and
structure state to decide (in broad terms) if scrub/repair are
supported by the running kernel.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
Darrick J. Wong
2017-10-17 21:37:36 -07:00
parent a56371865e
commit dcb660f922
7 changed files with 150 additions and 1 deletions

View File

@@ -483,9 +483,10 @@ struct xfs_scrub_metadata {
*/
/* Scrub subcommands. */
#define XFS_SCRUB_TYPE_PROBE 0 /* presence test ioctl */
/* Number of scrub subcommands. */
#define XFS_SCRUB_TYPE_NR 0
#define XFS_SCRUB_TYPE_NR 1
/* i: Repair this metadata. */
#define XFS_SCRUB_IFLAG_REPAIR (1 << 0)