IOCTL-XFS-INUMBERS(2)
๐ ioctl-xfs-inumbers โ the manual page, but make it cute โจ
okay bestie, this is ioctl-xfs-inumbers(2) from the System Calls Manual, and it's literally the glow-up your XFS inode-querying era needed. no cap. ๐ฆ
๐ธ NAME ๐ธ
ioctl_xfs_inumbers โ ask the kernel for allocation info about whole groups of XFS inodes, not just one at a time. it's giving bulk energy ๐
โจ SYNOPSIS โจ
#include <xfs/xfs_fs.h>
int ioctl(int fd, XFS_IOC_INUMBERS, struct xfs_inumbers_req *arg);
๐ DESCRIPTION ๐
so the whole vibe here is: you wanna know which inodes are allocated, but you're not about to do it one by one like some kind of peasant. this ioctl does a bulk transfer straight from the kernel, and it uses struct xfs_inumbers_req to set that up. iconic.
struct xfs_inumbers_req {
struct xfs_bulk_ireq hdr;
struct xfs_inumbers inumbers[];
};
and yes, the xfs_inumbers structure definition is coming, keep scrolling bestie ๐ซถ
struct xfs_bulk_ireq {
uint64_t ino;
uint32_t flags;
uint32_t icount;
uint32_t ocount;
uint32_t agno;
uint64_t reserved[5];
};
hdr is the part that describes what you're querying. its layout and behavior are fully documented over in the ioctl_xfs_bulkstat(2) manpage, so we're not gonna re-explain all that here. go read that one, it's a whole thing, and this page said not to discuss it further. periodt. ๐
inumbers is an array of struct xfs_inumbers, which is the next thing down there ๐ that array must have at least icount elements. no skimping.
struct xfs_inumbers {
uint64_t xi_startino;
uint64_t xi_allocmask;
uint8_t xi_alloccount;
uint8_t xi_version;
uint8_t xi_padding[6];
};
this little struct describes inode usage info for a group of 64 consecutive inode numbers. sixty-four. a whole squad. ๐
xi_startinoโ the first inode number of this group. the leader of the pack, the main character ๐xi_allocmaskโ a bitmask telling you which inodes in the group are allocated. to clarify (because the kernel is extra like that): bit N is set if inodexi_startino+Nis allocated. ๐xi_alloccountโ how many inodes in this group are allocated. this should be equal topopcnt(xi_allocmask). like, that's the math, bestie. ๐งฎxi_versionโ the version of this data structure. the kernel will set it toXFS_INUMBERS_VERSION_V5. slay โญxi_padding[6]โ zeroed. just vibes and emptiness. ๐ซง
๐ฅ RETURN VALUE ๐ฅ
if something goes wrong, -1 comes back at you and errno gets set to tell you what happened. that's it, that's the drama. ๐ญ
๐ ERRORS ๐
error codes can be one of, but are not limited to, these cuties:
EFAULTโ the kernel could not copy into the userspace buffer. sad. ๐EFSBADCRCโ metadata checksum validation failed while doing the query. the checksum said nope. ๐EFSCORRUPTEDโ metadata corruption was encountered while doing the query. something is deeply wrong in there. ๐ฑEINVALโ one of the arguments was not valid. invalid argument era. ๐ซEIOโ an I/O error was encountered while doing the query. ๐ENOMEMโ not enough memory to do the query. the RAM said "not today". ๐ธ
๐ CONFORMING TO ๐
this API is specific to the XFS filesystem on the Linux kernel. it does not play nice with others, it's exclusive. ๐
๐ฆ SEE ALSO ๐ฆ
okay that's the whole page, you're officially an XFS inode-group querying girly now ๐ go forth and ioctl responsibly. and yes, this lil masterpiece is from XFS, dated 2019-05-23 โ old but so iconic, she's been serving since 2019 and she's still booked and busy โจ๐
mwah ๐ bye bestie!
๐ฆ 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