IOCTL-XFS-FSINUMBERS(2)
π ioctl_xfs_fsinumbers β it's giving inode inventory β¨
okay bestie, welcome to section 2 of the System Calls Manual, where we're talking about ioctl_xfs_fsinumbers, which is literally the way you pull a whole list of valid inode numbers out of an XFS filesystem. it's not a libc thing, it's a system call manual thing, iykyk π
πΈ NAME πΈ
ioctl_xfs_fsinumbers</p> β extract a list of valid inode numbers from an XFS filesystem π¦
π SYNOPSIS π
#include <xfs/xfs_fs.h>
int ioctl(int fd, XFS_IOC_FSINUMBERS, struct xfs_fsop_bulkreq *arg);
β¨ DESCRIPTION β¨
so this bad boy queries inode allocation info from an XFS filesystem. the vibe is that you're supposed to call it iteratively until you've got the entire set of inodes β it's not a one-and-done situation, it's a "keep going until it says zero" situation, no cap π
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." set it to one less than the number of the first inode you want info about, or set it to zero if you wanna start with the very first inode in the filesystem. after the call, this value gets updated to the number of the last inode for which information is supplied. π«Ά heads up tho β this field will not be updated if ocount is NULL.
count is the number of elements in the ubuffer array, and therefore the number of inode groups you want allocation info for. it's giving "how many at a time, bestie" π
ocount points to a value that receives the number of records returned. an output value of zero means there are no more inode groups left to enumerate β that's your finish line, babes π if this value is NULL, then neither ocount nor lastip will be updated. yes, both. together. they're a package deal π
ubuffer points to a memory buffer where inode group information gets copied. this buffer must be an array of struct xfs_inogrp, which we're describing below. the array must have at least count elements. β
struct xfs_inogrp {
__u64 xi_startino;
__s32 xi_alloccount;
__u64 xi_allocmask;
}
this structure describes inode usage info for a group of 64 consecutive inode numbers. the fields are as follows, bestie, stay with me:
xi_startino is the first inode number of this group. πΈ
xi_alloccount is the number of bits that are set in xi_allocmask. this is the number of inodes allocated in this group. it's the headcount, basically π
xi_allocmask is a bitmask of inodes that are allocated in this inode group. the bitmask is 64 bits long, and the least significant bit corresponds to inode xi_startino. π¦
π RETURN VALUE π
on error, -1 is returned, and errno is set to indicate the error. classic. not me getting a negative one π
π ERRORS π
error codes can be one of, but are not limited to, the following β so like, don't assume this list is the whole alphabet, bestie:
EFAULTβ the kernel was not able to copy into the userspace buffer. rude, honestly.EFSBADCRCβ metadata checksum validation failed while performing the query. the checksum said "no β€οΈ".EFSCORRUPTEDβ metadata corruption was encountered while performing the query. something is deeply wrong in there πEINVALβ one of the arguments was not valid. you passed it something cursed, bestie.EIOβ an I/O error was encountered while performing the query. the disk said "not today" πENOMEMβ there was insufficient memory to perform the query. no room, no vibes.
π CONFORMING TO π
this API is specific to XFS filesystem on the Linux kernel. periodt. it's a very exclusive club, no other filesystem invited π
π SEE ALSO π
and that's the whole page, bestie!! this was XFS, dated 2019-06-17, and it lives in the IOCTL-XFS-FSINUMBERS(2) corner of the manual. go forth and enumerate those inodes, you absolute icon πβ¨π
π¦ 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
- centos-stream 9: xfsprogs-devel 6.4.0-9.el9 Β· GPL+ and LGPLv2+
- centos-stream 9: xfsprogs-devel 6.4.0-9.el9 Β· GPL+ and LGPLv2+
- debian bookworm: xfslibs-dev 6.1.0-1 Β· GPL-2.0-only
- 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 jammy: xfslibs-dev 5.13.0-1ubuntu2 Β· GPL-2.0-only
- ubuntu jammy: xfslibs-dev 5.13.0-1ubuntu2.1 Β· GPL-2.0-only
- ubuntu noble: xfslibs-dev 6.6.0-1ubuntu2 Β· GPL-2.0-only
- ubuntu noble: xfslibs-dev 6.6.0-1ubuntu2.1 Β· GPL-2.0-only
- 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