bio_split(9)
π bio_split(9) β like, the Kernel API Manual one, bestie
okay so you found the bio_split(9) page and honestly? slay. this is the kernel API manual's moment and i'm here to translate it into human (teen) language without losing a single crumb. π
β¨ NAME β¨
bio_split β split a bio. that's it. that's the whole vibe. it takes a bio and, um, splits it. iconic behavior fr fr π¦
πΈ SYNOPSIS πΈ
struct bio * bio_split (struct bio *bio , int sectors , gfp_t gfp ,
struct bio_set *bs );
look at her go π four args, one pointer returned, zero chill.
π«Ά ARGUMENTS π«Ά
bioβ the bio you're about to split. the main character, literally. πsectorsβ how many sectors you're splitting off from the front ofbio. front. the front. ngl this matters.gfpβ the gfp mask. yes babe, the allocation flags, we love a memory constraint moment.bsβ the bio set you're allocating from. that's your supply closet, don't lose it. π
π DESCRIPTION π
so what does it actually do? it allocates and returns a new bio that represents sectors from the start of bio, and then it updates bio itself so that bio now represents the remaining sectors. like a friend group splitting the fries: new bio gets the first sectors fries, old bio keeps the rest. π
here's the tea tho β unless this is a discard request, that newly allocated bio will point to bio's bi_io_vec. shared vec energy. iykyk.
β οΈ and this is the part where you pay attention: it is the caller's responsibility to ensure that neitherbionorbsare freed before the split bio. like, do not free your source bio, do not free your bio_set, or it's giving chaos and undefined sadness. the kernel will not save you. ππ
π SEE ALSO π
the kernel file ./block/bio.c says hi, plus this whole entire friend group of functions, all listed, all here, no crumbs left behind:
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_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_trim(9)bioset_init(9)
okay that's the whole page and you ate it π
β¨ sign-off time: this cutie lives under ./block, dates from October 2026, and answers to bio_split(9). go split responsibly, bestie π§π
π¦ 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