STRUCT FILE_RA_STATE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct file_ra_state(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual β€” yes, the actual kernel API manual, and yes we're reading it for fun. this page is all about struct file_ra_state, which is basically the little diary the kernel keeps about readahead. πŸŽ€


🌸 NAME 🌸

struct file_ra_state β€” track a file's readahead state, periodt. that's the whole vibe.


✨ SYNOPSIS ✨

struct file_ra_state {
    pgoff_t start;
    unsigned int size;
    unsigned int async_size;
    unsigned int ra_pages;
    unsigned short order;
    unsigned short mmap_miss;
    loff_t prev_pos;
 };

look at her. seven fields. main character energy fr. πŸ‘‘


πŸ¦‹ Members πŸ¦‹

okay literally let's go through every single one, no skipping, i promise:

  • start β€” where the most recent readahead kicked off. the starting line, the origin story. πŸ’«
  • size β€” how many pages got read in the most recent readahead. the headcount, basically.
  • async_size β€” number of pages that were/are not needed immediately, and so were/are genuinely "ahead". when the first of these pages gets accessed, that's your cue to start the next readahead. she's the early-warning system, iykyk. πŸ”₯
  • ra_pages β€” the maximum size of a readahead request, copied from the bdi. copied!! from the bdi!! respect her sources. ✨
  • order β€” the preferred folio order used for the most recent readahead. fancy formatting choices, we love to see it.
  • mmap_miss β€” how many mmap accesses missed in the page cache. a little counter of Ls tbh. πŸ’€
  • prev_pos β€” the last byte in the most recent read request. her most recent whereabouts. πŸ“

πŸ’– Description πŸ’–

so here's the tea 🍡: when this structure gets passed to ->readahead, the "most recent" readahead means the current readahead. that's it, that's the note. context is everything, bestie.


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/linux β€” and honestly the whole friend group came through:

enum positive_aop_returns(9), struct address_space(9), struct file(9), i_uid_into_vfsuid(9), i_uid_needs_update(9), i_uid_update(9), i_gid_into_vfsgid(9), i_gid_needs_update(9), i_gid_update(9), inode_fsuid_set(9), inode_fsgid_set(9), fsuidgid_has_mapping(9), inode_set_ctime(9), file_write_started(9), file_write_not_started(9), struct renamedata(9), is_mgtime(9), iput_if_not_last(9), is_idmapped_mnt(9), file_start_write(9), file_end_write(9), kiocb_start_write(9), kiocb_end_write(9), name_is_dot_dotdot(9), name_contains_dotdot(9), inode_dio_begin(9), inode_dio_end(9), generic_ci_validate_strict_name(9) 🫢

like, the whole extended family. go say hi. they're all iconic.


ngl if you read all 30 of those you deserve a little treat πŸ“

and that's the page!! sign-off time: this one lives under ./include/linux, it's dated October 2026, and it's filed under struct file_ra_state(9) in the Kernel API Manual. slay, study hard, and drink some water. πŸ’œπŸŒˆβ­

πŸ“¦ where this page comes from