filemap_set_wb_err(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… filemap_set_wb_err(9) β€” like, the Kernel API Manual page you actually want to read

okay so bestie, welcome to filemap_set_wb_err(9) from the Kernel API Manual β€” yes the whole manual, we're just vibing in one page of it. This one's short and sweet and honestly kind of a baddie: it's the function that writes down "hey, writeback flopped" so userspace can find out later. Let's get into it 🫢


✨ NAME ✨

filemap_set_wb_err β€” sets a writeback error on an address_space. that's it. that's the whole job. iconic minimalism πŸ’…


🌸 SYNOPSIS 🌸

void filemap_set_wb_err (struct address_space *mapping , int err );

returns nothing (void), takes two things. simplest little signature, ate and left no crumbs πŸ’–


πŸŽ€ ARGUMENTS πŸŽ€

  • mapping β€” the mapping where you're planting the writeback error. this is the spot, bestie 🌸
  • err β€” the actual error you're setting in that mapping. the message in the bottle πŸ“

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the whole plot: when writeback fails in some way, we must record that error β€” because otherwise userspace is just out here living its life with no idea. recording it means userspace can be informed when fsync and the like get called. and the goal (the endeavor, as the kernel girlies say) is to report errors on any file that was open at the time of the error 😭 literally any of them. also some internal callers need to know when writeback errors have occurred β€” not just userspace, the kernel's own friends too.

and then the practical bit: when a writeback error occurs, most filesystems will want to call filemap_set_wb_err to record the error in the mapping, so that it gets automatically reported whenever fsync is called on the file. automatic. no extra work. slay ✨

ngl this is the "write it down so future-you isn't confused" function and honestly? main character energy πŸ‘‘

πŸ”₯ SEE ALSO πŸ”₯

the kernel file lives at ./include/linux/pagemap.h, and here's the whole friend group β€” every single one, no cap:

that's forty-seven entries bestie, and we did not skip a single one πŸ’€πŸ’– iykyk.


🌈 sign-off 🌈

this lil page comes from the source dir ./include/linux, and it's dated October 2026 β€” that's the version/date energy for this one. go forth and record your writeback errors, you gorgeous kernel dev πŸ§šβ€β™€οΈβ­πŸŽ€

πŸ“¦ where this page comes from