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           XFS_BULK_IREQ_NREXT64
62                  If  this  is  set,  data  fork  extent count is returned via
63                  bs_extents64 field and 0 is assigned to bs_extents.   Other‐
64                  wise,  data  fork  extent  count  is returned via bs_extents
65                  field and bs_extents64 is assigned a value of 0. In the sec‐
66                  ond  case,  bs_extents is set to (2^31 - 1) if data fork ex‐
67                  tent count is larger than 2^31. This flag may be  set  inde‐
68                  pendently of whether other flags have been set.
69
70       hdr.icount  is the maximum number of records to return.  This should be
71       the size of the array that comes after the header.
72
73       hdr.ocount will be set to the number of records actually returned.
74
75       hdr.agno is the number of the allocation group (AG) for which  we  want
76       results.   If the XFS_BULK_IREQ_AGNO flag is not set, this field is ig‐
77       nored.
78
79       hdr.reserved must be set to zero.
80
81
82       bulkstat is an array of struct xfs_bulkstat which is  described  below.
83       The array must have at least icount elements.
84
85           struct xfs_bulkstat {
86                uint64_t                bs_ino;
87                uint64_t                bs_size;
88
89                uint64_t                bs_blocks;
90                uint64_t                bs_xflags;
91
92                uint64_t                bs_atime;
93                uint64_t                bs_mtime;
94
95                uint64_t                bs_ctime;
96                uint64_t                bs_btime;
97
98                uint32_t                bs_gen;
99                uint32_t                bs_uid;
100                uint32_t                bs_gid;
101                uint32_t                bs_projectid;
102
103                uint32_t                bs_atime_nsec;
104                uint32_t                bs_mtime_nsec;
105                uint32_t                bs_ctime_nsec;
106                uint32_t                bs_btime_nsec;
107
108                uint32_t                bs_blksize;
109                uint32_t                bs_rdev;
110                uint32_t                bs_cowextsize_blks;
111                uint32_t                bs_extsize_blks;
112
113                uint32_t                bs_nlink;
114                uint32_t                bs_extents;
115                uint32_t                bs_aextents;
116                uint16_t                bs_version;
117                uint16_t                bs_forkoff;
118
119                uint16_t                bs_sick;
120                uint16_t                bs_checked;
121                uint16_t                bs_mode;
122                uint16_t                bs_pad2;
123                uint64_t                bs_extents64;
124
125                uint64_t                bs_pad[6];
126           };
127
128       bs_ino is the inode number of this record.
129
130       bs_size is the size of the file, in bytes.
131
132       bs_blocks  is  the  number of filesystem blocks allocated to this file,
133       including metadata.
134
135       bs_xflags tell us what extended flags are set this inode.  These  flags
136       are  the same values as those defined in the XFS INODE FLAGS section of
137       the ioctl_xfs_fsgetxattr(2) manpage.
138
139       bs_atime is the last time this file was accessed, in seconds.
140
141       bs_mtime is the last time the contents of this file were  modified,  in
142       seconds.
143
144       bs_ctime is the last time this inode record was modified, in seconds.
145
146       bs_btime is the time this inode record was created, in seconds.
147
148       bs_gen is the generation number of the inode record.
149
150       bs_uid is the user id.
151
152       bs_gid is the group id.
153
154       bs_projectid is the the project id.
155
156       bs_atime_nsec  is  the nanoseconds component of the last time this file
157       was accessed.
158
159       bs_mtime_nsec is the nanoseconds component of the last  time  the  con‐
160       tents of this file were modified.
161
162       bs_ctime_nsec  is the nanoseconds component of the last time this inode
163       record was modified.
164
165       bs_btime_nsec is the nanoseconds  component  of  the  time  this  inode
166       record was created.
167
168       bs_blksize  is  the  size  of  a  data block for this file, in units of
169       bytes.
170
171       bs_rdev is the encoded device id if this is a special file.
172
173       bs_cowextsize_blks is the Copy on Write extent size hint for this file,
174       in units of data blocks.
175
176       bs_extsize_blks is the extent size hint for this file, in units of data
177       blocks.
178
179       bs_nlink is the number of hard links to this inode.
180
181       bs_extents is the number  of  storage  mappings  associated  with  this
182       file's data.
183
184       bs_aextents  is  the  number  of  storage mappings associated with this
185       file's extended attributes.
186
187       bs_version is the version of this data structure.  This will be set  to
188       XFS_BULKSTAT_VERSION_V5 by the kernel.
189
190       bs_forkoff  is the offset of the attribute fork in the inode record, in
191       bytes.
192
193       The fields bs_sick and bs_checked indicate the relative health of vari‐
194       ous  allocation group metadata.  Please see the section XFS INODE META‐
195       DATA HEALTH REPORTING for more information.
196
197       bs_mode is the file type and mode.
198
199       bs_pad[7] is zeroed.
200

RETURN VALUE

202       On error, -1 is returned, and errno is set to indicate the error.
203

XFS INODE METADATA HEALTH REPORTING

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

ERRORS

246       Error codes can be one of, but are not limited to, the following:
247
248       EFAULT The kernel was not able to copy into the userspace buffer.
249
250       EFSBADCRC
251              Metadata checksum validation failed while performing the query.
252
253       EFSCORRUPTED
254              Metadata corruption was encountered while performing the query.
255
256       EINVAL One of the arguments was not valid.
257
258       EIO    An I/O error was encountered while performing the query.
259
260       ENOMEM There was insufficient memory to perform the query.
261

CONFORMING TO

263       This API is specific to XFS filesystem on the Linux kernel.
264

SEE ALSO

266       ioctl(2), ioctl_xfs_fsgetxattr(2)
267
268
269
270XFS                               2019-05-23             IOCTL-XFS-BULKSTAT(2)
Impressum