bvec_folio(9)
π bvec_folio β like, the first folio energy
okay so bestie, this is a page from the Kernel API Manual (section 9, the kernel-API girlies) and it's all about bvec_folio. yes it's a real function, yes it's iconic, no you probably shouldn't call it. let's get into it β¨
β¨ SYNOPSIS β¨
struct folio * bvec_folio (const struct bio_vec *bv );
like that's the whole thing. one function, one pointer in, one folio pointer out. she's simple, she's elegant, she's got main character energy π
πΈ ARGUMENTS πΈ
bvβ the bvec you wanna poke at. that's it, that's the argument. it's thebvecto access, no cap π«Ά
π DESCRIPTION π
so here's the tea, and it's kind of a big deal π₯
A bvec can literally contain non-folio memory, meaning the thing you're looking at might not even be a folio like that. so this function should only be called by the creator of the bvec β the person who actually built it and knows what's in there. drivers? drivers have no business looking at the owner of the memory. none. zero. don't do it π
and lowkey it might not even be the right interface for the caller to use, because a bvec can span multiple folios β the way that one bvec can be holding like five folios at once and you're over here asking for "the first one" like that's gonna solve everything π
so honestly? you may be better off using something like bio_for_each_folio_all, which iterates over all the folios. yes, all of them. every single one. she's thorough, she's giving complete coverage, she ate π
fr fr: if you're a driver and you're reading this section thinking "but I just need one folio"β no. the manpage said what it said. bio_for_each_folio_all is right there. use her. π§
π¦ SEE ALSO π¦
- Kernel file
./include/linux/bvec.h struct bio_vec(9)bvec_set_page(9)bvec_set_folio(9)bvec_set_virt(9)bvec_kmap_local(9)memcpy_from_bvec(9)memcpy_to_bvec(9)memzero_bvec(9)bvec_virt(9)bvec_phys(9)
the whole bvec friend group, honestly. they all show up together, they all support each other, we love a cohesive cast π
π sign-off π
this absolute gem lives in ./include/linux and the page is dated October 2026 β so yeah, future girlie behavior, we love to see it. that's the whole manual page bestie, go forth and please not call bvec_folio from a driver, I'm begging π«Άπβ
π¦ 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