| 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-AG-GEOMETRY 2 2019-08-30 "XFS" |
| 7 |
.SH NAME |
| 8 |
ioctl_xfs_ag_geometry \- query XFS allocation group geometry information |
| 9 |
.SH SYNOPSIS |
| 10 |
.br |
| 11 |
.B #include <xfs/xfs_fs.h> |
| 12 |
.PP |
| 13 |
.BI "int ioctl(int " fd ", XFS_IOC_AG_GEOMETRY, struct xfs_ag_geometry *" arg ); |
| 14 |
.SH DESCRIPTION |
| 15 |
This XFS ioctl retrieves the geometry information for a given allocation group. |
| 16 |
The geometry information is conveyed in a structure of the following form: |
| 17 |
.PP |
| 18 |
.in +4n |
| 19 |
.nf |
| 20 |
struct xfs_ag_geometry { |
| 21 |
uint32_t ag_number; |
| 22 |
uint32_t ag_length; |
| 23 |
uint32_t ag_freeblks; |
| 24 |
uint32_t ag_icount; |
| 25 |
uint32_t ag_ifree; |
| 26 |
uint32_t ag_sick; |
| 27 |
uint32_t ag_checked; |
| 28 |
uint32_t ag_flags; |
| 29 |
uint64_t ag_reserved[12]; |
| 30 |
}; |
| 31 |
.fi |
| 32 |
.in |
| 33 |
.TP |
| 34 |
.I ag_number |
| 35 |
The caller must set this field to the index of the allocation group that the |
| 36 |
caller wishes to learn about. |
| 37 |
.TP |
| 38 |
.I ag_length |
| 39 |
The length of the allocation group is returned in this field, in units of |
| 40 |
filesystem blocks. |
| 41 |
.TP |
| 42 |
.I ag_freeblks |
| 43 |
The number of free blocks in the allocation group is returned in this field, in |
| 44 |
units of filesystem blocks. |
| 45 |
.TP |
| 46 |
.I ag_icount |
| 47 |
The number of inode records allocated in this allocation group is returned in |
| 48 |
this field. |
| 49 |
.TP |
| 50 |
.I ag_ifree |
| 51 |
The number of unused inode records (of the space allocated) in this allocation |
| 52 |
group is returned in this field. |
| 53 |
.TP |
| 54 |
.I ag_flags |
| 55 |
The caller can set this field to change the operational behavior of the ioctl. |
| 56 |
Currently no flags are defined, so this field must be zero. |
| 57 |
.TP |
| 58 |
.IR ag_reserved |
| 59 |
All reserved fields will be set to zero on return. |
| 60 |
.PP |
| 61 |
The fields |
| 62 |
.IR ag_sick " and " ag_checked |
| 63 |
indicate the relative health of various allocation group metadata: |
| 64 |
.IP \[bu] 2 |
| 65 |
If a given sick flag is set in |
| 66 |
.IR ag_sick , |
| 67 |
then that piece of metadata has been observed to be damaged. |
| 68 |
The same bit will be set in |
| 69 |
.IR ag_checked . |
| 70 |
.IP \[bu] |
| 71 |
If a given sick flag is set in |
| 72 |
.I ag_checked |
| 73 |
and is not set in |
| 74 |
.IR ag_sick , |
| 75 |
then that piece of metadata has been checked and is not faulty. |
| 76 |
.IP \[bu] |
| 77 |
If a given sick flag is not set in |
| 78 |
.IR ag_checked , |
| 79 |
then no conclusion can be made. |
| 80 |
.PP |
| 81 |
The following flags apply to these fields: |
| 82 |
.RS 0.4i |
| 83 |
.TP |
| 84 |
.B XFS_AG_GEOM_SICK_SB |
| 85 |
Allocation group superblock. |
| 86 |
.TP |
| 87 |
.B XFS_AG_GEOM_SICK_AGF |
| 88 |
Free space header. |
| 89 |
.TP |
| 90 |
.B XFS_AG_GEOM_SICK_AGFL |
| 91 |
Free space reserve list. |
| 92 |
.TP |
| 93 |
.B XFS_AG_GEOM_SICK_AGI |
| 94 |
Inode header. |
| 95 |
.TP |
| 96 |
.BR XFS_AG_GEOM_SICK_BNOBT " or " XFS_AG_GEOM_SICK_CNTBT |
| 97 |
Free space btrees. |
| 98 |
.TP |
| 99 |
.BR XFS_AG_GEOM_SICK_INOBT " or " XFS_AG_GEOM_SICK_FINOBT |
| 100 |
Inode btrees. |
| 101 |
.TP |
| 102 |
.B XFS_AG_GEOM_SICK_RMAPBT |
| 103 |
Reverse mapping btree. |
| 104 |
.TP |
| 105 |
.B XFS_AG_GEOM_SICK_REFCNTBT |
| 106 |
Reference count btree. |
| 107 |
.RE |
| 108 |
.SH RETURN VALUE |
| 109 |
On error, \-1 is returned, and |
| 110 |
.I errno |
| 111 |
is set to indicate the error. |
| 112 |
.PP |
| 113 |
.SH ERRORS |
| 114 |
Error codes can be one of, but are not limited to, the following: |
| 115 |
.TP |
| 116 |
.B EFSBADCRC |
| 117 |
Metadata checksum validation failed while performing the query. |
| 118 |
.TP |
| 119 |
.B EFSCORRUPTED |
| 120 |
Metadata corruption was encountered while performing the query. |
| 121 |
.TP |
| 122 |
.B EINVAL |
| 123 |
The specified allocation group number is not valid for this filesystem. |
| 124 |
.TP |
| 125 |
.B EIO |
| 126 |
An I/O error was encountered while performing the query. |
| 127 |
.SH CONFORMING TO |
| 128 |
This API is specific to XFS filesystem on the Linux kernel. |
| 129 |
.SH SEE ALSO |
| 130 |
.BR ioctl (2) |