ioctl_xfs_verify_media - Man Page
verify the media of the devices backing XFS
Synopsis
#include <xfs/xfs_fs.h>
int ioctl(int fd, XFS_IOC_VERIFY_MEDIA, struct xfs_verify_media *arg);
Description
Verify the media of a storage device backing an XFS filesystem. If errors are found, report the error to the kernel so that it can generate health events for the health monitoring system and fsnotify. The verification request is conveyed in a structure of the following form:
struct xfs_verify_media {
__u32 me_dev;
__u32 me_flags;
__u64 me_start_daddr;
__u64 me_end_daddr;
__u32 me_ioerror;
__u32 me_max_io_size;
__u32 me_rest_us;
__u32 me_pad;
};The field me_pad must be zero.
The field me_ioerror will be set if the ioctl returns success.
The fields me_start_daddr and me_end_daddr are the range of the storage device to verify. Both values must be in units of 512-byte blocks. The me_start_daddr field is inclusive, and the me_end_daddr field is exclusive. If me_end_daddr is larger than the size of the device, the kernel will set it to the size of the device.
If the system call returns success and any part of the storage device range was successfully verified, the me_start_daddr field will be updated to reflect the successful verification. If after this update the me_start_daddr is equal to me_end_daddr, then the entire range was verified successfully.
If not, then a media error was encountered and the caller should generate a series of secondary calls to this ioctl with smaller ranges to discover the exact location and type of media error. The type of media error will be written to the me_ioerror field.
The me_max_io_size field, if nonzero, is an upper bound on the I/O operations that the kernel will issue to the block device.
The me_rest_us is the time duration, in microseconds, for which the kernel will wait between issuing I/O operations.
The field me_dev must be one of the following values:
- XFS_DEV_DATA
Verify the data device.
- XFS_DEV_LOG
Verify the external log device.
- XFS_DEV_RT
Verify the realtime device.
The field me_flags is a bitmask of one of the following values:
- XFS_VERIFY_MEDIA_REPORT
Report all media errors to fsnotify.
The me_max_io_size field, if nonzero, will be used as advice for the maximum size of the IO to send to the device.
The me_rest_us field will cause the kernel to pause for this many microseconds between IO requests.
Return Value
On runtime error, -1 is returned, and errno is set to indicate the error. If 0 is returned, then start_daddr or ioerror will be updated.
Errors
Error codes can be one of, but are not limited to, the following:
- EPERM
The calling process does not have sufficient privilege.
- EINVAL
One or more of the arguments specified is invalid.
- EFAULT
The arg structure could not be copied into the kernel.
- ENODEV
The device is not present.
- ENOMEM
There was not enough memory to perform the verification.
I/O Errors
The ioerror field could be set to one of the following:
- 0
The verification I/O succeeded.
- EOPNOTSUPP
- ETIMEDOUT
The kernel timed out the verification I/O command.
- ENOLINK
The transportation link to the storage device was down temporarily.
- EREMOTEIO
The storage target controller suffered a critical error.
- ENODATA
The storage target media suffered a critical error.
- EILSEQ
Storage protection metadata did not validate successfully.
- ENOMEM
There was not enough memory to allocate an I/O request.
- ENODEV
The storage device is offline.
- ETIME
The storage device timed out the I/O command.
- EINVAL
The I/O request was rejected by the device for being invalid.
- EIO
An I/O error occurred but no specific details are available.
This list is not exhaustive and may grow in the future.
Conforming to
This API is specific to XFS filesystem on the Linux kernel.