IOCTL-XFS-GETRESBLKS(2)

πŸ’Ύ ioctl_xfs_getresblks β€” query and set XFS free space reservation information

okay bestie, so this is section 2 of the manual, ioctl-xfs-getresblks(2), and it's all about poking at XFS's emergency snack stash πŸ“. Sit down, hydrate, let's go.


✨ NAME ✨

ioctl_xfs_getresblks β€” query and set XFS free space reservation information


🌸 SYNOPSIS 🌸

#include <xfs/xfs_fs.h>

int ioctl(int fd, XFS_IOC_GET_RESBLKS, struct xfs_fsop_resblks *arg);
int ioctl(int fd, XFS_IOC_SET_RESBLKS, struct xfs_fsop_resblks *arg);

πŸ’– DESCRIPTION πŸ’–

So basically you're either querying or setting the free space reservation info. These blocks are the ones the filesystem keeps tucked away like a little emergency fund, as a final attempt to stop metadata updates from absolutely flopping because there's not enough space. It's giving "last line of defense" πŸ›‘οΈ.

🚨 Only the system administrator can use these ioctls, because overriding the defaults is extremely dangerous. Not me exaggerating β€” that's literally what it says. Periodt.

And listen: this functionality is intended only for use by XFS filesystem developers. So if that's not you... bestie, why are you here πŸ’€.

The reservation info travels around in a struct that looks exactly like this:

struct xfs_fsop_resblks {
     __u64  resblks;
     __u64  resblks_avail;
};

resblks β€” the number of blocks the filesystem will try to maintain to prevent critical out of space situations. The main character of the reservation, honestly πŸ‘‘.

resblks_avail β€” the number of reserved blocks still remaining. The leftovers. The crumbs. The ✨remaining✨.


πŸ”₯ 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 (so don't come for me if you see something else, fr fr):

  • EFSBADCRC β€” Metadata checksum validation failed while performing the query. The checksum said "ma'am this is not it" πŸ’€
  • EFSCORRUPTED β€” Metadata corruption was encountered while performing the query. Rot. Decay. Unwell behavior 😭
  • EINVAL β€” The specified allocation group number is not valid for this filesystem. Wrong AG, bestie, that one doesn't exist here 🚫
  • EIO β€” An I/O error was encountered while performing the query. The I/O is not I/O-ing πŸ™ˆ
  • EPERM β€” Caller does not have permission to call this ioctl. You do not have the range, babes 🫢

🌈 CONFORMING TO 🌈

This API is specific to XFS filesystem on the Linux kernel. It's a Linux/XFS exclusive, iykyk πŸ’….


πŸ¦‹ SEE ALSO πŸ¦‹


okay that's the whole vibe check β€” go be the XFS developer you were always meant to be ✨

with love, the XFS girlies, dated 2019-06-17, signing off from IOCTL-XFS-GETRESBLKS(2) πŸŽ€πŸ’œπŸ¦‹

πŸ“¦ where this page comes from