simple_write_end(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… simple_write_end β€” Kernel API Manual energy, but make it cute

okay so bestie, welcome to simple_write_end(9) from the Kernel API Manual β€” she's a tiny little helper living in the kernel and she's honestly iconic for how little she does. Let's get into it 🫢


✨ NAME ✨

simple_write_end β€” the .write_end helper for non-block-device FSes. That's it, that's the whole job description, and she slays it πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int simple_write_end (const struct kiocb *iocb , struct address_space
*mapping , loff_t pos , unsigned len , unsigned copied , struct folio
*folio , void *fsdata );

look at her, seven arguments, absolutely no notes 😭 copy this exactly, do not get creative, this is not the vibe for creative liberties.


πŸŽ€ ARGUMENTS πŸŽ€

okay so here's the thing β€” the man page is so real for this. Most of these just say " which is ditto-mark speak for "same as above", so mapping, pos, len, copied, folio and fsdata are all described as...

  • iocb β€” kernel I/O control block ✨
  • mapping β€” "
  • pos β€” "
  • len β€” "
  • copied β€” "
  • folio β€” "
  • fsdata β€” "

no cap, that's genuinely what's printed. Six little quotation marks. she said "read the room, you already know" πŸ˜­πŸ’€ ngl it's giving mysterious main character energy.


πŸ”₯ DESCRIPTION πŸ”₯

so what does she actually do? simple_write_end does the minimum needed for updating a folio after writing is done. Minimum effort, maximum usefulness β€” honestly relatable 🧚

she has the same API signature as the .write_end of the address_space_operations vector, which is the whole point: you can just set her straight onto .write_end for FSes that don't need any other processing. plug and play, no cap 🫢

a couple of house rules though, bestie:

  • i_rwsem is assumed to be held exclusively. assumed. as in, that's on you to actually do πŸ‘‘
  • Block based filesystems should use generic_write_end. not her. she's the non-block-device girlie. periodt.

🌈 NOTE 🌈

okay pay attention, this part matters πŸ™ˆ

Even though i_size might get updated by this function, mark_inode_dirty is not called. So if you're a filesystem that actually does store data in .write_inode, you need to extend on what's done here with a call to mark_inode_dirty in the case that i_size has changed. she updated the size but she did NOT tell anyone about it, so you have to be the one to spill the tea πŸ’€

Use *ONLY* with simple_read_folio β€” the asterisks are doing a lot of heavy lifting there and honestly they earned it. ONLY. πŸ”₯

🌸 SEE ALSO 🌸

Kernel file ./fs/libfs.c and her whole group chat of friends β€” all of them, in order, no one left on read:


and that's the whole page, bestie β€” ty for coming to my ted talk πŸ’– this lil queen lives in ./fs, the version vibes are October 2026, and she answers to simple_write_end(9) and nothing else. mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from