file_write_and_wait_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– file_write_and_wait_range β€” like, the Kernel API Manual page for it πŸ’–

okay so bestie, pull up a chair, because this one is from the Kernel API Manual and it's genuinely one of the more satisfying little functions once you get what it's doing. no cap.


✨ NAME ✨

file_write_and_wait_range β€” write out & wait on a file range. that's it, that's the whole vibe: push the bytes out, then wait for them like a bestie waiting for you to text back. 🫢


🌸 SYNOPSIS 🌸

int file_write_and_wait_range (struct file *file , loff_t lstart ,
       loff_t lend );

πŸŽ€ ARGUMENTS πŸŽ€

  • file β€” a file that points at an address_space that has pages in it. think of it as the main character of this whole operation πŸ’…
  • lstart β€” offset in bytes where the range starts. the beginning of the era, basically.
  • lend β€” offset in bytes where the range ends, and yes it's inclusive. (we'll get to why that slaps in a sec)

πŸ¦‹ DESCRIPTION πŸ¦‹

Write out and wait upon file offsets lstart->lend, inclusive. literally write, then wait. no skipping the waiting part, that's the whole point, iykyk.

Note that lend is inclusive (it describes the last byte to be written) so that this function can be used to write to the very end-of-file (end = -1). it's giving "off-by-one but make it intentional" and honestly? iconic. ✨

After writing out and waiting on the data, we check and advance the f_wb_err cursor to the latest value, and return any errors detected there. so it's not just write-and-dip β€” it does a little vibe check on the error cursor before it leaves. πŸ”₯


⭐ RETURN ⭐

0 on success, negative error code otherwise. that's it. zero is the slay outcome, negative means something went off and you should look at it. 😭


πŸ’œ SEE ALSO πŸ’œ

so this function has so many friends, it's honestly giving group chat with 44 members and everyone's typing at once. Kernel file ./mm/filemap.c is the home base, and here's the whole squad:

like, that's the whole friend group. read them, love them, cross-reference them. πŸ‘‘


btw bestie, no scary warnings on this page and no deprecation drama β€” it's just write, wait, check the cursor, return. clean. 🧚

and that's the page!! mwah πŸ’‹ this came out of ./mm in October 2026, and it's still filed under file_write_and_wait_range(9) β€” go forth and wait on your ranges, bestie πŸ’–πŸŒˆπŸ“

πŸ“¦ where this page comes from