file_fdatawait_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– file_fdatawait_range β€” wait for writeback to complete πŸ’–

okay so bestie, this is a page from the Kernel API Manual (9 section, kernel dev vibes only) and it's literally all about one function that makes you wait. no cap. let's get into it 🫢


✨ SYNOPSIS ✨

int file_fdatawait_range (struct file *file , loff_t start_byte , loff_t
end_byte );

like, that's it. that's the whole signature. three args, returns an int. slay πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • file β€” the file that points at the address space structure you're waiting on. it's giving "which one of y'all am I babysitting" energy ✨
  • start_byte β€” the offset in bytes where the range starts. where the drama begins 🌸
  • end_byte β€” the offset in bytes where the range ends, and yeah it's inclusive, so don't come for me about off-by-one, she's included πŸ‘‘

🌈 DESCRIPTION 🌈

so what it actually does: it walks the list of under-writeback pages belonging to the address space that file refers to, but only in the given range, and waits for all of them. like a little line of pages all going "still writing!!" and this function is the friend going "okay bestie I'll wait" πŸ¦‹

then it checks the error status of the address space vs. the file->f_wb_err cursor and returns it. iykyk πŸ’œ

🚨 important caveat, fr fr β€” since the error status of the file is advanced by this function, callers are responsible for checking the return value and handling and/or reporting the error. like, do not just ignore it, that's not the vibe. 😭

⭐ RETURN ⭐

the error status of the address space vs. the file->f_wb_err cursor. that's the whole return, no extras, periodt πŸ’―


🧚 SEE ALSO 🧚

Kernel file ./mm/filemap.c β€” and here's the full squad, not skipping a single one, because everyone deserves their moment:


okay that's the whole page, go forth and wait on your writeback responsibly πŸ’œ

cute little sign-off: this legend lives in the ./mm source directory, and this particular printing is the October 2026 version. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from