bio_add_vmalloc_chunk(9)
π bio_add_vmalloc_chunk(9) β a Kernel API Manual moment
okay bestie, so this one lives in the Kernel API Manual and it's giving "small helper, big responsibility" energy. Let's get into it β¨
π NAME π
bio_add_vmalloc_chunk β literally just adds a vmalloc chunk to a bio. that's it. that's the whole job. π
β¨ SYNOPSIS β¨
unsigned int bio_add_vmalloc_chunk (struct bio *bio , void *vaddr ,
unsigned len );
like, three args, one unsigned int back. no cap, she's lowkey elegant π¦
πΈ ARGUMENTS πΈ
bioβ the destination bio. the β¨main characterβ¨ of this whole operation, the one receiving the data π«Άvaddrβ the vmalloc address you're adding. yes, this specific one, pls don't mix it up πlenβ total length in bytes of the data you want to add. the full wishlist, basically π
π DESCRIPTION π
so what she does is: add the data starting at vaddr to bio, and then tell you how many bytes actually made it in. π₯
heads up though β that number might be less than what you originally asked for. not a bug, just how she is. and if nothing at all could be added to bio, she returns 0. periodt π
she also calls flush_kernel_vmap_range for the range that got added β icon behavior, honestly, taking care of that for you π§
β οΈ but for reads? you're not off the hook, bestie. the caller still needs to manually call invalidate_kernel_vmap_range in the completion handler. don't forget, i'm begging π
π SEE ALSO π
fr fr, go read these too, they're all in the kernel file ./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(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)
and that's the whole page, bestie π this lil number came out of the ./block directory, dated October 2026, and she goes by bio_add_vmalloc_chunk(9) β go forth and slay your bio builds β¨π
π¦ 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