IOCTL-XFS-SCRUBV-METADATA(2) System Calls Manual IOCTL-XFS-SCRUBV-METADATA(2)

# [NAME](#NAME)

ioctl\_xfs\_scrubv\_metadata - check a lot of XFS filesystem metadata

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;xfs/xfs\_fs.h&gt;**

**int ioctl(int dest\_fd, XFS\_IOC\_SCRUBV\_METADATA, struct xfs\_scrub\_vec\_head \*arg);**

# [DESCRIPTION](#DESCRIPTION)

This XFS ioctl asks the kernel driver to examine several pieces of filesystem metadata for errors or suboptimal metadata. Multiple scrub types can be invoked to target a single filesystem object. See [**ioctl\_xfs\_scrub\_metadata**(2)](/man/os/xfsprogs/ioctl_xfs_scrub_metadata.2) for a discussion of metadata validation, and documentation of the various **XFS\_SCRUB\_TYPE** and **XFS\_SCRUB\_FLAGS** values referenced below.

The types and location of the metadata to scrub are conveyed as a vector with a header of the following form:

```
struct xfs_scrub_vec_head {
	__u64 svh_ino;
	__u32 svh_gen;
	__u32 svh_agno;
	__u32 svh_flags;
	__u16 svh_rest_us;
	__u16 svh_nr;
	__u64 svh_reserved;
	__u64 svh_vectors;
};
```

The field *svh\_ino*, *svh\_gen*, and *svh\_agno* correspond to the *sm\_ino*, *sm\_gen*, and *sm\_agno* fields of the regular scrub ioctl. Exactly one filesystem object can be specified in a single call. The kernel will proceed with each vector in *svh\_vectors* until progress is no longer possible.

The field *svh\_rest\_us* specifies an amount of time to pause between each scrub invocation to give the system a chance to process other requests.

The field *svh\_nr* specifies the number of vectors in the *svh\_vectors* array.

The field *svh\_vectors* is a pointer to an array of **struct xfs\_scrub\_vec** structures.

The field *svh\_reserved* must be zero.

Each vector has the following form:

```
struct xfs_scrub_vec {
	__u32 sv_type;
	__u32 sv_flags;
	__s32 sv_ret;
	__u32 sv_reserved;
};
```

The fields *sv\_type* and *sv\_flags* indicate the type of metadata to check and the behavioral changes that userspace will permit of the kernel. The *sv\_flags* field will be updated upon completion of the scrub call. See the documentation of **XFS\_SCRUB\_TYPE\_\*** and **XFS\_SCRUB\_\[IO]FLAG\_\*** values in [**ioctl\_xfs\_scrub\_metadata**(2)](/man/os/xfsprogs/ioctl_xfs_scrub_metadata.2) for a detailed description of their purpose.

If a vector's *sv\_type* field is set to the value **XFS\_SCRUB\_TYPE\_BARRIER**, the kernel will stop processing vectors and return to userspace if a scrubber flags corruption by setting one of the **XFS\_SCRUB\_OFLAG\_\*** values in *sv\_flags* or returns an operation error in *sv\_ret*. Otherwise, the kernel returns only after processing all vectors.

The *sv\_ret* field is set to the return value of the scrub function. See the RETURN VALUE section of the [**ioctl\_xfs\_scrub\_metadata**(2)](/man/os/xfsprogs/ioctl_xfs_scrub_metadata.2) manual page for more information.

The **sv\_reserved** field must be zero.

# [RETURN VALUE](#RETURN_VALUE)

On error, -1 is returned, and *errno* is set to indicate the error.

# [ERRORS](#ERRORS)

Error codes can be one of, but are not limited to, the following:

[**EINVAL**](#EINVAL)

One or more of the arguments specified is invalid.

[**EINTR**](#EINTR)

The operation was interrupted.

[**ENOMEM**](#ENOMEM)

There was not sufficient memory to perform the scrub or repair operation.

[**EFAULT**](#EFAULT)

A memory fault was encountered while reading or writing the vector.

# [CONFORMING TO](#CONFORMING_TO)

This API is specific to XFS filesystem on the Linux kernel.

# [NOTES](#NOTES)

These operations may block other filesystem operations for a long time. A calling process can stop the operation by being sent a fatal signal, but non-fatal signals are blocked.

# [SEE ALSO](#SEE_ALSO)

[**ioctl**(2)](/man/os/xfsprogs/ioctl.2) [**ioctl\_xfs\_scrub\_metadata**(2)](/man/os/xfsprogs/ioctl_xfs_scrub_metadata.2) [**xfs\_scrub**(8)](/man/os/xfsprogs/xfs_scrub.8) [**xfs\_repair**(8)](/man/os/xfsprogs/xfs_repair.8)

2024-05-21 XFS

---

Document: ioctl_xfs_scrubv_metadata(2) from xfsprogs 7.2.1-r0 (Chainguard OS)
Source: https://kernel.googlesource.com/pub/scm/fs/xfs/xfsprogs-dev
