IOCTL-XFS-FSBULKSTAT(2)
π IOCTL-XFS-FSBULKSTAT β the XFS bulk inode stat tea β
okay bestie, welcome to ioctl_xfs_fsbulkstat, straight outta the System Calls Manual section, and no cap this one is giving vintage. It's an ioctl, it's XFS-only, and it wants to hand you stat info for a whole lil squad of inodes at once. Let's get into it. π¦
β¨ NAME β¨
ioctl_xfs_fsbulkstat β query information for a batch of XFS inodes π«Ά
πΈ SYNOPSIS πΈ
#include <xfs/xfs_fs.h>
int ioctl(int fd, XFS_IOC_FSBULKSTAT, struct xfs_fsop_bulkreq *arg);
int ioctl(int fd, XFS_IOC_FSBULKSTAT_SINGLE, struct xfs_fsop_bulkreq
*arg);
two flavors, one vibe: one for a batch of inodes, one for a single inode. pick your fighter. β¨
π DESCRIPTION π
So basically: you're querying stat information for a group of XFS inodes. That's the whole assignment. π
NOTE: this ioctl has been superseded. please go read the ioctl_xfs_bulkstat(2) manpage for info about its replacement. like, it still works (presumably) but it's giving "we don't do that here anymore," iykyk. π
These ioctls use struct xfs_fsop_bulkreq to set up a bulk transfer with the kernel:
struct xfs_fsop_bulkreq {
__u64 *lastip;
__s32 count;
void *ubuffer;
__s32 *ocount;
};
lastip points to a value that will receive the number of the "last inode." This cannot be NULL. periodt.
- For
FSBULKSTAT, this should be set to one less than the number of the first inode for which the caller wants information, or zero to start with the first inode in the filesystem. - For
FSBULKSTAT_SINGLE, this should be set to the number of the inode for which the caller wants information.
After the call, this value will be set to the number of the last inode for which information was supplied. π
β οΈ This field will not be updated ifocountisNULL. noted bestie.
count is the number of elements in the ubuffer array and therefore the number of inodes for which to return stat information. This value must be set to 1 for FSBULKSTAT_SINGLE. one. uno. single. πΈ
ocount points to a value that will receive the number of records returned. If this value is NULL, then neither ocount nor lastip will be updated. (yes babe, they're a package deal π)
ubuffer points to a memory buffer into which inode stat information will be copied. This buffer must be an array of struct xfs_bstat which is described below. The array must have at least count elements.
struct xfs_bstat {
__u64 bs_ino;
__u16 bs_mode;
__u16 bs_nlink;
__u32 bs_uid;
__u32 bs_gid;
__u32 bs_rdev;
__s32 bs_blksize;
__s64 bs_size;
struct xfs_bstime bs_atime;
struct xfs_bstime bs_mtime;
struct xfs_bstime bs_ctime;
int64_t bs_blocks;
__u32 bs_xflags;
__s32 bs_extsize;
__s32 bs_extents;
__u32 bs_gen;
__u16 bs_projid_lo;
__u16 bs_forkoff;
__u16 bs_projid_hi;
uint16_t bs_sick;
uint16_t bs_checked;
unsigned char bs_pad[2];
__u32 bs_cowextsize;
__u32 bs_dmevmask;
__u16 bs_dmstate;
__u16 bs_aextents;
};
π§ the structure members, one by one π§
bs_inois the inode number for this record.bs_modeis the file type and mode.bs_nlinkis the number of hard links to this inode.bs_uidis the user id.bs_gidis the group id.bs_rdevis the encoded device id if this is a special file.bs_blksizeis the size of a data block for this file, in units of bytes.bs_sizeis the size of the file, in bytes.bs_atimeis the last time this file was accessed.bs_mtimeis the last time the contents of this file were modified.bs_ctimeis the last time this inode record was modified.bs_blocksis the number of filesystem blocks allocated to this file, including metadata.bs_xflagscontains the extended flags that are set on this inode. These flags are the same values as those defined in the XFS INODE FLAGS section of theioctl_xfs_fsgetxattr(2)manpage. (go look there, we're not re-typing them π )bs_extsizeis the extent size hint for this file, in bytes.bs_extentsis the number of storage mappings associated with this file's data.bs_genis the generation number of the inode record.bs_projid_lois the lower 16-bits of the project id.bs_forkoffis the offset of the attribute fork in the inode record, in bytes.bs_projid_hiis the upper 16-bits of the project id.bs_pad[6]is zeroed.bs_cowextsizeis the Copy on Write extent size hint for this file, in bytes.bs_dmevmaskis unused on Linux.bs_dmstateis unused on Linux.bs_aextentsis the number of storage mappings associated with this file's extended attributes.
π the health check section (vibe check for metadata) π
The fields bs_sick and bs_checked indicate the relative health of various inode metadata. it's literally a doctor's appointment for your inodes, no cap:
- If a given sick flag is set in
bs_sick, then that piece of metadata has been observed to be damaged. The same bit should be set inbs_checked. (double-confirmed, it's sick fr π) - If a given sick flag is set in
bs_checkedbut is not set inbs_sick, then that piece of metadata has been checked and is not faulty. she's healthy bestie π - If a given sick flag is not set in
bs_checked, then no conclusion can be made. we simply do not know. shrug.
β the flags that apply to these fields β
XFS_BS_SICK_INODEβ the inode's record itself.XFS_BS_SICK_BMBTDβ file data extent mappings.XFS_BS_SICK_BMBTAβ extended attribute extent mappings.XFS_BS_SICK_BMBTCβ Copy on Write staging extent mappings.XFS_BS_SICK_DIRβ directory information.XFS_BS_SICK_XATTRβ extended attribute data.XFS_BS_SICK_SYMLINKβ symbolic link target.XFS_BS_SICK_PARENTβ parent pointers.XFS_BS_SICK_DIRTREEβ directory is the source of corruption in the directory tree. π¨
π₯ RETURN VALUE π₯
On error, -1 is returned, and errno is set to indicate the error. classic. π
π ERRORS π
Error codes can be one of, but are not limited to, the following:
EFAULTβ the kernel was not able to copy into the userspace buffer. (rude of it tbh)EFSBADCRCβ metadata checksum validation failed while performing the query.EFSCORRUPTEDβ metadata corruption was encountered while performing the query.EINVALβ one of the arguments was not valid. check ur args babe πEIOβ an I/O error was encountered while performing the query.ENOMEMβ there was insufficient memory to perform the query.
π CONFORMING TO π
This API is specific to XFS filesystem on the Linux kernel. Linux girlies only. π§
π«Ά SEE ALSO π«Ά
and that's the whole page bestie!! this one's from XFS, dated 2019-06-17, living its life as IOCTL-XFS-FSBULKSTAT(2) in the System Calls Manual. superseded but still iconic, honestly. go forth and bulk-stat responsibly. slay. πβ¨π¦
π¦ where this page comes from
- alpine 3.22: xfsprogs-doc 6.14.0-r0 Β· LGPL-2.1-or-later
- alpine 3.23: xfsprogs-doc 6.17.0-r0 Β· LGPL-2.1-or-later
- alpine 3.24: xfsprogs-doc 7.0.1-r0 Β· LGPL-2.1-or-later
- arch rolling: xfsprogs 7.2.0-1
- arch rolling: xfsprogs 7.2.1-1 Β· GPL-2.0-only AND LGPL-2.1-only
- centos-stream 10: xfsprogs-devel 6.16.0-1.el10 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- debian trixie: xfslibs-dev 6.13.0-2+deb13u1 Β· GPL-2.0-only
- fedora 43: xfsprogs-devel 6.15.0-3.fc43 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 43: xfsprogs-devel 6.15.0-3.fc43 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 6.18.0-2.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 6.18.0-2.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 7.1.1-1.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 7.1.1-1.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- nixos 26.05: xfsprogs 6.19.0
- nixpkgs unstable: xfsprogs 7.2.1
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- ubuntu questing: xfslibs-dev 6.13.0-2ubuntu2
- ubuntu resolute: xfslibs-dev 6.18.0-3 Β· GPL-2.0-only
- ubuntu stonking: xfslibs-dev 6.19.0-1 Β· GPL-2.0-only
- π the page's license: GPL-2.0+
- Copyright (c) 2019, Oracle. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms