| 1 |
.\" Copyright (c) 2019, Oracle. All rights reserved. |
| 2 |
.\" |
| 3 |
.\" %%%LICENSE_START(GPLv2+_DOC_FULL) |
| 4 |
.\" SPDX-License-Identifier: GPL-2.0+ |
| 5 |
.\" %%%LICENSE_END |
| 6 |
.TH IOCTL-XFS-INUMBERS 2 2019-05-23 "XFS" |
| 7 |
.SH NAME |
| 8 |
ioctl_xfs_inumbers \- query allocation information for groups of XFS inodes |
| 9 |
.SH SYNOPSIS |
| 10 |
.br |
| 11 |
.B #include <xfs/xfs_fs.h> |
| 12 |
.PP |
| 13 |
.BI "int ioctl(int " fd ", XFS_IOC_INUMBERS, struct xfs_inumbers_req *" arg ); |
| 14 |
.SH DESCRIPTION |
| 15 |
Query inode allocation information for groups of XFS inodes. |
| 16 |
This ioctl uses |
| 17 |
.B struct xfs_inumbers_req |
| 18 |
to set up a bulk transfer from the kernel: |
| 19 |
.PP |
| 20 |
.in +4n |
| 21 |
.nf |
| 22 |
struct xfs_inumbers_req { |
| 23 |
struct xfs_bulk_ireq hdr; |
| 24 |
struct xfs_inumbers inumbers[]; |
| 25 |
}; |
| 26 |
.fi |
| 27 |
.in |
| 28 |
.PP |
| 29 |
See below for the |
| 30 |
.B xfs_inumbers |
| 31 |
structure definition. |
| 32 |
.PP |
| 33 |
.in +4n |
| 34 |
.nf |
| 35 |
struct xfs_bulk_ireq { |
| 36 |
uint64_t ino; |
| 37 |
uint32_t flags; |
| 38 |
uint32_t icount; |
| 39 |
uint32_t ocount; |
| 40 |
uint32_t agno; |
| 41 |
uint64_t reserved[5]; |
| 42 |
}; |
| 43 |
.fi |
| 44 |
.in |
| 45 |
.PP |
| 46 |
.I hdr |
| 47 |
describes the information to query. |
| 48 |
The layout and behavior are documented in the |
| 49 |
.BR ioctl_xfs_bulkstat (2) |
| 50 |
manpage and will not be discussed further here. |
| 51 |
|
| 52 |
.PP |
| 53 |
.I inumbers |
| 54 |
is an array of |
| 55 |
.B struct xfs_inumbers |
| 56 |
which is described below. |
| 57 |
The array must have at least |
| 58 |
.I icount |
| 59 |
elements. |
| 60 |
.PP |
| 61 |
.in +4n |
| 62 |
.nf |
| 63 |
struct xfs_inumbers { |
| 64 |
uint64_t xi_startino; |
| 65 |
uint64_t xi_allocmask; |
| 66 |
uint8_t xi_alloccount; |
| 67 |
uint8_t xi_version; |
| 68 |
uint8_t xi_padding[6]; |
| 69 |
}; |
| 70 |
.fi |
| 71 |
.in |
| 72 |
.PP |
| 73 |
This structure describes inode usage information for a group of 64 consecutive |
| 74 |
inode numbers. |
| 75 |
.PP |
| 76 |
.I xi_startino |
| 77 |
is the first inode number of this group. |
| 78 |
.PP |
| 79 |
.I xi_allocmask |
| 80 |
is a bitmask telling which inodes in this group are allocated. |
| 81 |
To clarify, bit |
| 82 |
.B N |
| 83 |
is set if inode |
| 84 |
.BR xi_startino + N |
| 85 |
is allocated. |
| 86 |
.PP |
| 87 |
.I xi_alloccount |
| 88 |
is the number of inodes in this group that are allocated. |
| 89 |
This should be equal to popcnt(xi_allocmask). |
| 90 |
.PP |
| 91 |
.I xi_version |
| 92 |
is the version of this data structure. |
| 93 |
This will be set to |
| 94 |
.I XFS_INUMBERS_VERSION_V5 |
| 95 |
by the kernel. |
| 96 |
.PP |
| 97 |
.I xi_padding[6] |
| 98 |
is zeroed. |
| 99 |
.SH RETURN VALUE |
| 100 |
On error, \-1 is returned, and |
| 101 |
.I errno |
| 102 |
is set to indicate the error. |
| 103 |
.PP |
| 104 |
.SH ERRORS |
| 105 |
Error codes can be one of, but are not limited to, the following: |
| 106 |
.TP |
| 107 |
.B EFAULT |
| 108 |
The kernel was not able to copy into the userspace buffer. |
| 109 |
.TP |
| 110 |
.B EFSBADCRC |
| 111 |
Metadata checksum validation failed while performing the query. |
| 112 |
.TP |
| 113 |
.B EFSCORRUPTED |
| 114 |
Metadata corruption was encountered while performing the query. |
| 115 |
.TP |
| 116 |
.B EINVAL |
| 117 |
One of the arguments was not valid. |
| 118 |
.TP |
| 119 |
.B EIO |
| 120 |
An I/O error was encountered while performing the query. |
| 121 |
.TP |
| 122 |
.B ENOMEM |
| 123 |
There was insufficient memory to perform the query. |
| 124 |
.SH CONFORMING TO |
| 125 |
This API is specific to XFS filesystem on the Linux kernel. |
| 126 |
.SH SEE ALSO |
| 127 |
.BR ioctl (2), |
| 128 |
.BR ioctl_xfs_bulkstat (2). |