1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
.\" Copyright (c) 2019, Oracle. All rights reserved.
.\"
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
.\" SPDX-License-Identifier: GPL-2.0+
.\" %%%LICENSE_END
.TH IOCTL-XFS-FSGEOMETRY 2 2019-06-17 "XFS"
.SH NAME
ioctl_xfs_fsgeometry \- report XFS filesystem layout and features
.SH SYNOPSIS
.br
.B #include <xfs/xfs_fs.h>
.PP
.BI "int ioctl(int " fd ", XFS_IOC_FSGEOMETRY, struct xfs_fsop_geom *" arg );
.br
.BI "int ioctl(int " fd ", XFS_IOC_FSGEOMETRY_V4, struct xfs_fsop_geom_v4 *" arg );
.br
.BI "int ioctl(int " fd ", XFS_IOC_FSGEOMETRY_V1, struct xfs_fsop_geom_v1 *" arg );
.SH DESCRIPTION
Report the details of an XFS filesystem layout, features, and other descriptive items.
This information is conveyed in a structure of the following form:
.PP
.in +4n
.nf
struct xfs_fsop_geom {
__u32 blocksize;
__u32 rtextsize;
__u32 agblocks;
__u32 agcount;
__u32 logblocks;
__u32 sectsize;
__u32 inodesize;
__u32 imaxpct;
__u64 datablocks;
__u64 rtblocks;
__u64 rtextents;
__u64 logstart;
unsigned char uuid[16];
__u32 sunit;
__u32 swidth;
__s32 version;
__u32 flags;
__u32 logsectsize;
__u32 rtsectsize;
__u32 dirblocksize;
/* struct xfs_fsop_geom_v1 stops here. */
__u32 logsunit;
/* struct xfs_fsop_geom_v4 stops here. */
__u32 sick;
__u32 checked;
__u64 reserved[17];
};
.fi
.in
.PP
.I blocksize
is the size of a fundamental filesystem block, in bytes.
.PP
.I rtextsize
is the size of an extent on the realtime volume, in bytes.
.PP
.I agblocks
is the size of an allocation group, in units of filesystem blocks.
.PP
.I agcount
is the number of allocation groups in the filesystem.
.PP
.I logblocks
is the size of the log, in units of filesystem blocks.
.PP
.I sectsize
is the smallest amount of data that can be written to the data device
atomically, in bytes.
.PP
.I inodesize
is the size of an inode record, in bytes.
.PP
.I imaxpct
is the maximum percentage of the filesystem that can be allocated to inode
record blocks.
.PP
.I datablocks
is the size of the data device, in units of filesystem blocks.
.PP
.I rtblocks
is the size of the realtime device, in units of filesystem blocks.
.PP
.I rtextents
is the number of extents that can be allocated on the realtime device.
.PP
.I logstart
is the start of the log, in units of filesystem blocks.
If the filesystem has an external log, this will be zero.
.PP
.I uuid
is the universal unique identifier of the filesystem.
.PP
.I sunit
is what the filesystem has been told is the size of a RAID stripe unit on the
underlying data device, in filesystem blocks.
.PP
.I swidth
is what the filesystem has been told is the width of a RAID stripe on the
underlying data device, in units of RAID stripe units.
.PP
.I version
is the version of this structure.
This value will be XFS_FSOP_GEOM_VERSION.
.PP
.I flags
tell us what features are enabled on the filesystem.
Refer to the section
.B FILESYSTEM FEATURE FLAGS
below for more information about each feature.
.PP
.I logsectsize
is the smallest amount of data that can be written to the log device atomically,
in bytes.
.PP
.I rtsectsize
is the smallest amount of data that can be written to the realtime device
atomically, in bytes.
.PP
.I dirblocksize
is the size of directory blocks, in bytes.
.PP
.I logsunit
is what the filesystem has been told is the size of a RAID stripe unit on the
underlying log device, in filesystem blocks.
This field is meaningful only if the flag
.B XFS_FSOP_GEOM_FLAGS_LOGV2
is set.
.PP
The fields
.IR sick " and " checked
indicate the relative health of various whole-filesystem metadata.
Please see the section
.B XFS METADATA HEALTH REPORTING
for more details.
.PP
.I reserved
is set to zero.
.SH FILESYSTEM FEATURE FLAGS
Filesystem features are reported to userspace as a combination the following
flags:
.TP
.B XFS_FSOP_GEOM_FLAGS_ATTR
Extended attributes are present.
.TP
.B XFS_FSOP_GEOM_FLAGS_NLINK
Files on this filesystem support up to 2^32 hard links.
If this flag is not set, files on this filesystem support only up to 2^16
hard links.
.TP
.B XFS_FSOP_GEOM_FLAGS_QUOTA
Quotas are enabled.
.TP
.B XFS_FSOP_GEOM_FLAGS_IALIGN
Inodes are aligned for better performance.
.TP
.B XFS_FSOP_GEOM_FLAGS_DALIGN
Filesystem tries to align data block allocations to RAID stripe units for
better performance.
.TP
.B XFS_FSOP_GEOM_FLAGS_SHARED
Unused.
.TP
.B XFS_FSOP_GEOM_FLAGS_EXTFLG
Filesystem supports unwritten extents.
.TP
.B XFS_FSOP_GEOM_FLAGS_DIRV2
Directories are in version 2 format and maintain free space data for better
performance.
Version 1 format directories are no longer supported.
.TP
.B XFS_FSOP_GEOM_FLAGS_LOGV2
Log uses the V2 format.
.TP
.B XFS_FSOP_GEOM_FLAGS_SECTOR
The log device has a sector size larger than 512 bytes.
.TP
.B XFS_FSOP_GEOM_FLAGS_ATTR2
Filesystem contains V2 extended attributes.
.TP
.B XFS_FSOP_GEOM_FLAGS_PROJID32
Project IDs can be as large as 2^32.
If this flag is not set, the filesystem supports only 2^16 project IDs.
.TP
.B XFS_FSOP_GEOM_FLAGS_DIRV2CI
Case-insensitive lookups are supported on directories.
.TP
.B XFS_FSOP_GEOM_FLAGS_LAZYSB
On-disk superblock counters are updated only at unmount time.
.TP
.B XFS_FSOP_GEOM_FLAGS_V5SB
Metadata blocks are self describing and contain checksums.
.TP
.B XFS_FSOP_GEOM_FLAGS_FTYPE
Directories contain inode types in directory entries.
.TP
.B XFS_FSOP_GEOM_FLAGS_FINOBT
Filesystem maintains an index of free inodes.
.TP
.B XFS_FSOP_GEOM_FLAGS_SPINODES
Filesystem may allocate discontiguous inode chunks when free space is
fragmented.
.TP
.B XFS_FSOP_GEOM_FLAGS_RMAPBT
Filesystem stores reverse mappings of blocks to owners.
.TP
.B XFS_FSOP_GEOM_FLAGS_REFLINK
Filesystem supports sharing blocks between files.
.RE
.SH XFS METADATA HEALTH REPORTING
.PP
The online filesystem checking utility scans metadata and records what it
finds in the kernel incore state.
The following scheme is used for userspace to read the incore health status
of the filesystem:
.IP \[bu] 2
If a given sick flag is set in
.IR sick ,
then that piece of metadata has been observed to be damaged.
The same bit should be set in
.IR checked .
.IP \[bu]
If a given sick flag is set in
.I checked
but is not set in
.IR sick ,
then that piece of metadata has been checked and is not faulty.
.IP \[bu]
If a given sick flag is not set in
.IR checked ,
then no conclusion can be made.
.PP
The following flags apply to these fields:
.RS 0.4i
.TP
.B XFS_FSOP_GEOM_SICK_COUNTERS
Inode and space summary counters.
.TP
.B XFS_FSOP_GEOM_SICK_UQUOTA
User quota information.
.TP
.B XFS_FSOP_GEOM_SICK_GQUOTA
Group quota information.
.TP
.B XFS_FSOP_GEOM_SICK_PQUOTA
Project quota information.
.TP
.B XFS_FSOP_GEOM_SICK_RT_BITMAP
Free space bitmap for the realtime device.
.TP
.B XFS_FSOP_GEOM_SICK_RT_SUMMARY
Free space summary for the realtime device.
.RE
.SH RETURN VALUE
On error, \-1 is returned, and
.I errno
is set to indicate the error.
.PP
.SH ERRORS
Error codes can be one of, but are not limited to, the following:
.TP
.B EFAULT
The kernel was not able to copy into the userspace buffer.
.TP
.B EFSBADCRC
Metadata checksum validation failed while performing the query.
.TP
.B EFSCORRUPTED
Metadata corruption was encountered while performing the query.
.TP
.B EIO
An I/O error was encountered while performing the query.
.SH CONFORMING TO
This API is specific to XFS filesystem on the Linux kernel.
.SH SEE ALSO
.BR ioctl (2)
|