bioset_init(9)
β¨ bioset_init(9) β¨
Okay bestie, welcome to the bioset_init(9) page from the Kernel API Manual π β this is the glow-up ritual that gets your bio_set ready for the party, and we're gonna walk through it together, no cap π
πΈ NAME πΈ
bioset_init β literally just: initialize a bio_set π
π¦ SYNOPSIS π¦
int bioset_init (struct bio_set *bs , unsigned int pool_size , unsigned
int front_pad , int flags );
That's the whole vibe check right there β four args, one int coming back atcha β
π ARGUMENTS π
bsβ the pool you're about to initialize. This is the main character here, the bio_set that's getting set up π«Άpool_sizeβ how manybios andbio_vecs you want cached in the mempool. Pick your number, that's your stash β¨front_padβ number of bytes to allocate in front of the returned bio. Sneaky little headroom situation πflagsβ flags that modify behavior. Currently that'sBIOSET_NEED_BVECSandBIOSET_NEED_RESCUER, and yes those are the only two on the menu rn π
π₯ DESCRIPTION π₯
So what this does: it sets up a bio_set meant to be used with bio_alloc_bioset. It also lets the caller ask for a number of bytes to be allocated in front of the bio π«
And why would you want a front pad? Because it's genuinely useful for embedding the bio inside another structure, so you don't have to allocate extra data to go with the bio. Iconic, efficient, obsessed π§
β οΈ But hear me loud and clear: the bio must be embedded at the END of that structure, always. Not the middle, not the front, the END. Otherwise things will break badly ππ That's not a vibe check, that's a hard requirement.
Now the flags, one at a time, because details matter and we don't skip:
- If
BIOSET_NEED_BVECSis set inflags, a separate pool gets allocated for allocating iovecs. That pool is not needed e.g. forbio_init_cloneβ so don't come for it if you skip it π - If
BIOSET_NEED_RESCUERis set, a workqueue is created, and it can be used to dispatch queued requests when the mempool runs out of space. Rescue mission energy fr fr π
π SEE ALSO π
Kernel file ./block/bio.c β the whole friend group π
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_split(9)bio_trim(9)
That's the whole page, bestie β go init that bio_set and slay π β¨
Sign-off szn π: this one lives in ./block, dated October 2026, and it's bioset_init(9) all day long. Catch you in the next manpage! π¦π«Ά
π¦ 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