filemap_fdatawait_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… filemap_fdatawait_range (Kernel API Manual, bestie!)

okay so picture this: you're deep in the kernel, in the 9 section of the manual, and you just need to wait for writeback to be done. that's the whole vibe of this function β€” filemap_fdatawait_range β€” and yes it literally does what it says on the tin: it waits for writeback to complete. no cap. πŸŽ€


✨ SYNOPSIS ✨

int filemap_fdatawait_range (struct address_space *mapping , loff_t
start_byte , loff_t end_byte );

like, it returns an int, takes a struct address_space *mapping, and two loff_ts: start_byte and end_byte. that's the whole signature, she's not complicated πŸ¦‹


🌸 ARGUMENTS 🌸

  • mapping β€” the address space structure you're waiting on. this is the main character of the whole operation, honestly. πŸ‘‘
  • start_byte β€” offset in bytes where the range starts.
  • end_byte β€” offset in bytes where the range ends, and note that it's inclusive β€” she's in the range, not politely standing outside it. 🫢

πŸ’– DESCRIPTION πŸ’–

so here's what happens: it walks the list of under-writeback pages of the given address space, in the given range, and waits for all of them. every single one. no skipping, no "eh close enough". then it checks the error status of the address space and returns it back to you. slay. ✨

🚨 important, bestie, read this twice: since the error status of the address space is cleared by this function, callers are responsible for checking the return value and handling and/or reporting the error. it's giving "you break it, you bought it". the function does not remember the error for you β€” it hands it to you and wipes it. so if you ignore the return value, that error is just… gone. 😭 fr fr, do not let that happen.

🌈 RETURN 🌈

the error status of the address space. that's it, that's the return value. catching it and actually doing something with it is your job. πŸ’€


πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./mm/filemap.c and honestly the whole friend group:


πŸŽ€ okay that's the whole page, you ate that. this one lives in ./mm and it's dated October 2026 β€” so go forth, wait for your writeback, and please check that return value. ily, bye! πŸ’œπŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from