bio_add_vmalloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– bio_add_vmalloc β€” add a vmalloc region to a bio πŸ’–

okay so bestie, welcome to the Kernel API Manual, section 9 πŸŽ€. This one's a little function with big main-character energy: bio_add_vmalloc. Let's get into it.


✨ SYNOPSIS ✨

bool bio_add_vmalloc (struct bio *bio , void *vaddr , unsigned int len
);

that's it. that's the whole vibe. bool in, bool out, three args, we move. πŸ¦‹


🌸 ARGUMENTS 🌸

  • bio β€” the destination bio πŸ’Œ like, this is the bio you're stuffing data into. it's the receiver. the it-girl. everything's going in here.
  • vaddr β€” the vmalloc address to add 🧚 this is your void *, the starting point of the region you're handing over. no cap, it's just an address.
  • len β€” the total length in bytes of the data to add πŸ“ so like. how much. in bytes. total. that's the number.

πŸ‘‘ DESCRIPTION πŸ‘‘

so what it actually does: it adds data starting at vaddr to bio 🌈 and it returns true on success, or false if bio doesn't have enough space for the payload 😭 β€” like, the bio is full, there's no room, it's giving sold-out-arena, and you get a false back. no drama, just facts.

✨ and here's the part you can't skip ✨ β€” this helper calls flush_kernel_vmap_range for the range added. it does that for you, automatically, bestie. you're welcome.

🫢 but for reads, the caller still needs to manually call invalidate_kernel_vmap_range in the completion handler. that one is not covered. that's on you. don't forget it, i'm begging πŸ™ˆ

⭐ SEE ALSO ⭐

okay this list is lowkey iconic, it's the whole friend group πŸ’… β€” and the kernel file is ./block/bio.c:

like, twenty-eight whole legends. go read them. iykyk πŸ’€


sign-off time, bestie πŸ’œ β€” this little masterpiece lives in ./block, it's dated October 2026, and yeah, we're still calling it bio_add_vmalloc(9). slay. periodt. πŸŽ€βœ¨

πŸ“¦ where this page comes from