bio_add_vmalloc(9)
π 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 destinationbioπ 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 yourvoid *, 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:
bio_reset(9)bio_reuse(9)bio_chain(9)bio_chain_and_submit(9)bio_alloc_bioset(9)bio_kmalloc(9)bio_truncate(9)guard_bio_eod(9)bio_put(9)bio_alloc_clone(9)bio_init_clone(9)bio_full(9)__bio_add_page(9)bio_add_virt_nofail(9)bio_add_page(9)bio_add_folio(9)bio_add_vmalloc_chunk(9)bio_iov_iter_get_pages(9)bio_iov_iter_bounce(9)bio_iov_iter_unbounce(9)bio_await(9)submit_bio_wait(9)bdev_rw_virt(9)bio_copy_data(9)bio_endio(9)bio_split(9)bio_trim(9)bioset_init(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms