IOCTL-XFS-SCRUBV-METADATA(2)
π IOCTL-XFS-SCRUBV-METADATA π
okay bestie, welcome to the System Calls Manual page for ioctl_xfs_scrubv_metadata, aka the XFS ioctl that does a whole vibe check on a bunch of your filesystem metadata at once. sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
ioctl_xfs_scrubv_metadata β check a lot of XFS filesystem metadata π
β¨ SYNOPSIS β¨
#include <xfs/xfs_fs.h>
int ioctl(int dest_fd, XFS_IOC_SCRUBV_METADATA, struct
xfs_scrub_vec_head *arg);
β¨ DESCRIPTION β¨
so basically, this XFS ioctl walks up to the kernel driver and is like "hey, can you look at several pieces of filesystem metadata for errors, or for metadata that's just... not giving? π¬" and the kernel is like "say less." Multiple scrub types can be invoked to target a single filesystem object. If you want the whole discussion of what metadata validation even is, plus documentation of all the various XFS_SCRUB_TYPE and XFS_SCRUB_FLAGS values mentioned below, go read ioctl_xfs_scrub_metadata(2). it's giving prequel. π
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 fields 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 β one object per call, we do not share, this is a monogamous syscall π«Ά. 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. like a little breather. a hydration break. π§
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. zero. nada. nothing. don't even think about it π
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 β so it's not just input, it's got main character energy coming and going. β¨ See the documentation of XFS_SCRUB_TYPE_* and XFS_SCRUB_[IO]FLAG_* values in 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. so like... it's a barrier. a little "we stop here if it's messy" checkpoint π§
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) manual page for more information.
The sv_reserved field must be zero. again. zero. it's the rule. β
β¨ RETURN VALUE β¨
On error, -1 is returned, and errno is set to indicate the error. classic. π
β¨ ERRORS β¨
Error codes can be one of, but are not limited to, the following:
EINVALβ One or more of the arguments specified is invalid. (not me passing a bad argument π)EINTRβ The operation was interrupted.ENOMEMβ There was not sufficient memory to perform the scrub or repair operation. bestie we are BROKE on memory πEFAULTβ A memory fault was encountered while reading or writing the vector.
β¨ CONFORMING TO β¨
This API is specific to XFS filesystem on the Linux kernel. it does not play nice with others, it's exclusive, it's an XFS-only situation π
β¨ 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.
translation: it can hog the whole filesystem for a while, and the only way out is a fatal signal. non-fatal signals? blocked. ignored. not the moment. π€
β¨ SEE ALSO β¨
ioctl(2) Β· ioctl_xfs_scrub_metadata(2) Β· xfs_scrub(8) Β· xfs_repair(8)
and that's the whole page bestie!! π this one's from XFS, dated 2024-05-21, and it lives under the manual name IOCTL-XFS-SCRUBV-METADATA(2) β slay, go scrub something responsibly π
β¨
π¦ where this page comes from
- alpine 3.22: xfsprogs-doc 6.14.0-r0 Β· LGPL-2.1-or-later
- alpine 3.23: xfsprogs-doc 6.17.0-r0 Β· LGPL-2.1-or-later
- alpine 3.24: xfsprogs-doc 7.0.1-r0 Β· LGPL-2.1-or-later
- arch rolling: xfsprogs 7.2.0-1
- arch rolling: xfsprogs 7.2.1-1 Β· GPL-2.0-only AND LGPL-2.1-only
- centos-stream 10: xfsprogs-devel 6.16.0-1.el10 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- debian trixie: xfslibs-dev 6.13.0-2+deb13u1 Β· GPL-2.0-only
- fedora 43: xfsprogs-devel 6.15.0-3.fc43 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 43: xfsprogs-devel 6.15.0-3.fc43 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 6.18.0-2.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 6.18.0-2.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 7.1.1-1.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 7.1.1-1.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- nixos 26.05: xfsprogs 6.19.0
- nixpkgs unstable: xfsprogs 7.2.1
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- ubuntu questing: xfslibs-dev 6.13.0-2ubuntu2
- ubuntu resolute: xfslibs-dev 6.18.0-3 Β· GPL-2.0-only
- ubuntu stonking: xfslibs-dev 6.19.0-1 Β· GPL-2.0-only
- π the page's license: GPL-2.0-or-later
- Copyright (c) 2023-2024 Oracle. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms