bio_split(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 of bio. 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 neither bio nor bs are 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:


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