IOCTL-XFS-RTGROUP-GEOMETRY(2)

πŸ’– IOCTL-XFS-RTGROUP-GEOMETRY πŸ’–

okay bestie, so this whole page lives in the System Calls Manual and the star of the show is the ioctl called ioctl_xfs_rtgroup_geometry β€” say that three times fast, I dare you 🫢. She's giving "I just want to know about my realtime groups" energy and honestly? iconic.


✨ NAME ✨

ioctl_xfs_rtgroup_geometry β€” literally just here to query XFS realtime group geometry info πŸ’…


🌸 SYNOPSIS 🌸

#include <xfs/xfs_fs.h>

int ioctl(int fd, XFS_IOC_RTGROUP_GEOMETRY, struct xfs_rtgroup_geometry
*arg);

no cap, that's the whole vibe.


πŸ¦‹ DESCRIPTION πŸ¦‹

So this XFS ioctl? She retrieves the geometry information for a given realtime group. Think of it as sliding into the DMs of one specific realtime group and asking "so what's your deal bestie".

The tea gets delivered in a struct that looks exactly like this:

struct xfs_rtgroup_geometry {
     __u32  rg_number;
     __u32  rg_length;
     __u32  rg_sick;
     __u32  rg_checked;
     __u32  rg_flags;
     __u32  rg_writepointer;
     __u32  rg_reserved[26];
};

and here's what each field is actually doing:

  • rg_number β€” you, the caller, gotta set this one yourself. It's the index of the realtime group you're tryna learn about. yes, you have to do a little work. it's giving participation πŸ’€
  • rg_length β€” this gets returned to you: the length of the realtime group, measured in units of filesystem blocks. slay.
  • rg_flags β€” you can set this field to change the operational behavior of the ioctl. but rn? no flags are defined, so this field must be zero. periodt.
  • rg_writepointer β€” for zoned devices only, this returns the writepointer block offset into the respective realtime group. heads up though: this field is valid only if the XFS_RTGROUP_GEOM_WRITEPOINTER flag is set in rg_flags. don't come for me if you forget 🫠
  • rg_reserved and rg_pad β€” all reserved fields get set to zero on return. pristine. immaculate. ✨

🌈 the health check section 🌈

the fields rg_sick and rg_checked are here to tell you about the relative health of various realtime group metadata. it's basically a vibe check for your filesystem:

  • if a given sick flag is set in rg_sick, then that piece of metadata has been observed to be damaged 😭 and the same bit will be set in rg_checked.
  • if a given sick flag is set in rg_checked but not set in rg_sick, then that piece of metadata has been checked and is not faulty. she's healthy, we love that πŸ’–
  • if a given sick flag is not set in rg_checked, then no conclusion can be made. we simply do not know. the mystery remains πŸ™ˆ

πŸ’… the flags πŸ’…

these are the flags that apply to those fields:

  • XFS_RTGROUP_GEOM_SICK_SUPER β€” realtime group superblock.
  • XFS_RTGROUP_GEOM_SICK_BITMAP β€” realtime bitmap for this group.
  • XFS_RTGROUP_GEOM_SICK_SUMMARY β€” realtime summary for this group.
  • XFS_RTGROUP_GEOM_SICK_RTRMAPBT β€” reverse mapping btree for this group.

πŸ’€ RETURN VALUE πŸ’€

on error, -1 is returned and errno is set to indicate the error. classic. no notes.


πŸŽ€ ERRORS πŸŽ€

error codes can be one of β€” but are not limited to β€” the following:

  • EFSBADCRC β€” metadata checksum validation failed while performing the query. the checksum said "not today" βœ‹
  • EFSCORRUPTED β€” metadata corruption was encountered while performing the query. she's broken bestie, truly πŸ’”
  • EINVAL β€” the specified realtime group number is not valid for this filesystem. wrong number, wrong girl πŸ“΅
  • EIO β€” an I/O error was encountered while performing the query. the disk is being dramatic 😀

πŸ‘‘ CONFORMING TO πŸ‘‘

this API is specific to the XFS filesystem on the Linux kernel. no portability, no traveling, she stays home 🏠


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page babes πŸ’œ one last thing: this little masterpiece comes from the XFS crew and it's dated 2022-08-18 β€” so yeah, she's been serving correct information since then, fr fr. go query some realtime groups, main character πŸ¦‹βœ¨

πŸ“¦ where this page comes from