iov_iter_extract_bvecs(9)
π iov_iter_extract_bvecs β Kernel API Manual β¨
okay so bestie, welcome to iov_iter_extract_bvecs(9), straight out of the Kernel API Manual β yes that manual, the one we all pretend we've read π
This is the page for iov_iter_extract_bvecs, and it's literally about pulling bvecs out of an iterator. Slay. Let's get into it π¦
πΈ NAME πΈ
iov_iter_extract_bvecs β Extract bvecs from an iterator. that's it, that's the whole vibe π
β¨ SYNOPSIS β¨
ssize_t iov_iter_extract_bvecs (struct iov_iter *iter , struct bio_vec
*bv , size_t max_size , unsigned short *nr_vecs , unsigned short
max_vecs , unsigned mem_align_mask , iov_iter_extraction_t
extraction_flags );
no cap, that's a whole lot of parameters, but we're gonna go through every single one together π«Ά
π ARGUMENTS π
iterβ the iterator you're extracting from. your main character, if you will πbvβ the bvec return array. this is where the extracted goodies land πmax_sizeβ the maximum size to extract fromiter. a lil boundary, respect it πnr_vecsβ number of vectors inbv, and heads up bestie, it's on in and output β it goes both ways πmax_vecsβ the maximum vectors inbv, including those filled before calling. so like, count the ones already there, don't be out here acting like the array was empty πmem_align_maskβ reject with-EINVALif the source address or length is not aligned to this mask. alignment is not optional, it's a lifestyle βextraction_flagsβ flags to qualify the request. the little extra seasoning on top π₯
π DESCRIPTION π
So think of it like iov_iter_extract_pages, but make it bvec π
β instead of returning multiple entries, it returns physically contiguous ranges contained in a single folio as a single bvec. fewer entries, same energy. iconic behaviour honestly π
It returns the number of bytes extracted when successful, or a negative errno. and ngl, there's one lil quirk to know: if nr_vecs was non-zero on entry, the number of successfully extracted bytes can be 0. not a bug, just how it is, so don't come for it π
π§ SEE ALSO π§
- Kernel file
./lib/iov_iter.c _copy_mc_to_iter(9)_copy_from_iter_flushcache(9)iov_iter_folio_queue(9)iov_iter_xarray(9)iov_iter_discard(9)import_iovec(9)iov_iter_restore(9)iov_iter_extract_pages(9)
like a whole friend group of functions, fr fr β go say hi to all of them π¦
lowkey important: that-EINVALon misalignment inmem_align_maskis real, and that0-bytes-extracted case whennr_vecswas non-zero on entry is real too. know them, love them, don't get surprised by them π
and that's the page babes π this one lives in ./lib, dated October 2026, and it's filed under iov_iter_extract_bvecs(9) β periodt. go extract some bvecs, you're gonna eat πβ¨πΈ
π¦ 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