iov_iter_extract_bvecs(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 from iter. a lil boundary, respect it πŸ’…
  • nr_vecs β€” number of vectors in bv, and heads up bestie, it's on in and output β€” it goes both ways 😭
  • max_vecs β€” the maximum vectors in bv, 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 -EINVAL if 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 🧚

like a whole friend group of functions, fr fr β€” go say hi to all of them πŸ¦‹


lowkey important: that -EINVAL on misalignment in mem_align_mask is real, and that 0-bytes-extracted case when nr_vecs was 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