1IOCTL-XFS-BULKSTAT(2)         System Calls Manual        IOCTL-XFS-BULKSTAT(2)
2
3
4

NAME

6       ioctl_xfs_bulkstat - query information for a batch of XFS inodes
7

SYNOPSIS

9       #include <xfs/xfs_fs.h>
10
11       int ioctl(int fd, XFS_IOC_BULKSTAT, struct xfs_bulkstat_req *arg);
12

DESCRIPTION

14       Query  stat  information  for  a  group of XFS inodes.  This ioctl uses
15       struct xfs_bulkstat_req to set up a bulk transfer from the kernel:
16
17           struct xfs_bulkstat_req {
18                struct xfs_bulk_ireq    hdr;
19                struct xfs_bulkstat     bulkstat[];
20           };
21
22       See below for the xfs_bulkstat structure definition.
23
24           struct xfs_bulk_ireq {
25                uint64_t                ino;
26                uint32_t                flags;
27                uint32_t                icount;
28                uint32_t                ocount;
29                uint32_t                agno;
30                uint64_t                reserved[5];
31           };
32
33       hdr.ino should be set to the number of the first inode  for  which  the
34       caller  wants information; or zero to start with the first inode in the
35       filesystem; or a special value if XFS_BULK_IREQ_SPECIAL is set  in  the
36       flags field.  Note that this is a different semantic than the lastip in
37       the old FSBULKSTAT ioctl.  After the call, this value will  be  set  to
38       the  number  of  the  next  inode for which information could supplied.
39       This sets up the next call for an iteration loop.
40
41       If the XFS_BULK_IREQ_SPECIAL flag is set in the flags  field,  the  ino
42       field is interpreted according to the following special values:
43
44           XFS_BULK_IREQ_SPECIAL_ROOT
45                  Return stat information for the root directory inode.
46
47       hdr.flags is a bit set of operational flags:
48
49           XFS_BULK_IREQ_AGNO
50                  If  this  is  set, the call will only return results for the
51                  allocation group (AG) set in hdr.agno.  If hdr.ino is set to
52                  zero, results will be returned starting with the first inode
53                  in the AG.  This flag may not be set at the same time as the
54                  XFS_BULK_IREQ_SPECIAL flag.
55
56           XFS_BULK_IREQ_SPECIAL
57                  If  this  is set, results will be returned for only the spe‐
58                  cial inode specified in the hdr.ino field.   This  flag  may
59                  not be set at the same time as the XFS_BULK_IREQ_AGNO flag.
60
61       hdr.icount  is the maximum number of records to return.  This should be
62       the size of the array that comes after the header.
63
64       hdr.ocount will be set to the number of records actually returned.
65
66       hdr.agno is the number of the allocation group (AG) for which  we  want
67       results.   If  the  XFS_BULK_IREQ_AGNO  flag  is not set, this field is
68       ignored.
69
70       hdr.reserved must be set to zero.
71
72
73       bulkstat is an array of struct xfs_bulkstat which is  described  below.
74       The array must have at least icount elements.
75
76           struct xfs_bulkstat {
77                uint64_t                bs_ino;
78                uint64_t                bs_size;
79
80                uint64_t                bs_blocks;
81                uint64_t                bs_xflags;
82
83                uint64_t                bs_atime;
84                uint64_t                bs_mtime;
85
86                uint64_t                bs_ctime;
87                uint64_t                bs_btime;
88
89                uint32_t                bs_gen;
90                uint32_t                bs_uid;
91                uint32_t                bs_gid;
92                uint32_t                bs_projectid;
93
94                uint32_t                bs_atime_nsec;
95                uint32_t                bs_mtime_nsec;
96                uint32_t                bs_ctime_nsec;
97                uint32_t                bs_btime_nsec;
98
99                uint32_t                bs_blksize;
100                uint32_t                bs_rdev;
101                uint32_t                bs_cowextsize_blks;
102                uint32_t                bs_extsize_blks;
103
104                uint32_t                bs_nlink;
105                uint32_t                bs_extents;
106                uint32_t                bs_aextents;
107                uint16_t                bs_version;
108                uint16_t                bs_forkoff;
109
110                uint16_t                bs_sick;
111                uint16_t                bs_checked;
112                uint16_t                bs_mode;
113                uint16_t                bs_pad2;
114
115                uint64_t                bs_pad[7];
116           };
117
118       bs_ino is the inode number of this record.
119
120       bs_size is the size of the file, in bytes.
121
122       bs_blocks  is  the  number of filesystem blocks allocated to this file,
123       including metadata.
124
125       bs_xflags tell us what extended flags are set this inode.  These  flags
126       are  the same values as those defined in the XFS INODE FLAGS section of
127       the ioctl_xfs_fsgetxattr(2) manpage.
128
129       bs_atime is the last time this file was accessed, in seconds.
130
131       bs_mtime is the last time the contents of this file were  modified,  in
132       seconds.
133
134       bs_ctime is the last time this inode record was modified, in seconds.
135
136       bs_btime is the time this inode record was created, in seconds.
137
138       bs_gen is the generation number of the inode record.
139
140       bs_uid is the user id.
141
142       bs_gid is the group id.
143
144       bs_projectid is the the project id.
145
146       bs_atime_nsec  is  the nanoseconds component of the last time this file
147       was accessed.
148
149       bs_mtime_nsec is the nanoseconds component of the last  time  the  con‐
150       tents of this file were modified.
151
152       bs_ctime_nsec  is the nanoseconds component of the last time this inode
153       record was modified.
154
155       bs_btime_nsec is the nanoseconds  component  of  the  time  this  inode
156       record was created.
157
158       bs_blksize  is  the  size  of  a  data block for this file, in units of
159       bytes.
160
161       bs_rdev is the encoded device id if this is a special file.
162
163       bs_cowextsize_blks is the Copy on Write extent size hint for this file,
164       in units of data blocks.
165
166       bs_extsize_blks is the extent size hint for this file, in units of data
167       blocks.
168
169       bs_nlink is the number of hard links to this inode.
170
171       bs_extents is the number  of  storage  mappings  associated  with  this
172       file's data.
173
174       bs_aextents  is  the  number  of  storage mappings associated with this
175       file's extended attributes.
176
177       bs_version is the version of this data structure.  This will be set  to
178       XFS_BULKSTAT_VERSION_V5 by the kernel.
179
180       bs_forkoff  is the offset of the attribute fork in the inode record, in
181       bytes.
182
183       The fields bs_sick and bs_checked indicate the relative health of vari‐
184       ous  allocation group metadata.  Please see the section XFS INODE META‐
185       DATA HEALTH REPORTING for more information.
186
187       bs_mode is the file type and mode.
188
189       bs_pad[7] is zeroed.
190

RETURN VALUE

192       On error, -1 is returned, and errno is set to indicate the error.
193

XFS INODE METADATA HEALTH REPORTING

195       The online filesystem checking utility scans inode metadata and records
196       what it finds in the kernel incore state.  The following scheme is used
197       for userspace to read the incore health status of an inode:
198
199       · If a given sick flag is set in bs_sick, then that piece  of  metadata
200         has  been  observed  to  be  damaged.   The same bit should be set in
201         bs_checked.
202
203       · If a given sick flag is set in bs_checked but is not set in  bs_sick,
204         then that piece of metadata has been checked and is not faulty.
205
206       · If a given sick flag is not set in bs_checked, then no conclusion can
207         be made.
208
209       The following flags apply to these fields:
210
211           XFS_BS_SICK_INODE
212                  The inode's record itself.
213
214           XFS_BS_SICK_BMBTD
215                  File data extent mappings.
216
217           XFS_BS_SICK_BMBTA
218                  Extended attribute extent mappings.
219
220           XFS_BS_SICK_BMBTC
221                  Copy on Write staging extent mappings.
222
223           XFS_BS_SICK_DIR
224                  Directory information.
225
226           XFS_BS_SICK_XATTR
227                  Extended attribute data.
228
229           XFS_BS_SICK_SYMLINK
230                  Symbolic link target.
231
232           XFS_BS_SICK_PARENT
233                  Parent pointers.
234

ERRORS

236       Error codes can be one of, but are not limited to, the following:
237
238       EFAULT The kernel was not able to copy into the userspace buffer.
239
240       EFSBADCRC
241              Metadata checksum validation failed while performing the query.
242
243       EFSCORRUPTED
244              Metadata corruption was encountered while performing the query.
245
246       EINVAL One of the arguments was not valid.
247
248       EIO    An I/O error was encountered while performing the query.
249
250       ENOMEM There was insufficient memory to perform the query.
251

CONFORMING TO

253       This API is specific to XFS filesystem on the Linux kernel.
254

SEE ALSO

256       ioctl(2), ioctl_xfs_fsgetxattr(2)
257
258
259
260XFS                               2019-05-23             IOCTL-XFS-BULKSTAT(2)
Impressum