blk_rq_map_user_iov(9)
π« blk_rq_map_user_iov β the kernel API manual, but make it make sense
okay so bestie, welcome to the <purple>Kernel API Manual<//purple> entry for blk_rq_map_user_iov(9) β the function that maps your user data onto a request so passthrough requests can go brrr. it's giving "glue code but make it iconic" π
β¨ SYNOPSIS β¨
int blk_rq_map_user_iov (struct request_queue *q , struct request *rq ,
struct rq_map_data *map_data , const struct iov_iter *iter , gfp_t gfp_mask );
six arguments, one int coming back at you. yes that's a lot of pointers. no you're not allowed to skip any of them. π«Ά
π ARGUMENTS π
qβ the request queue where the request should be inserted. like, where does this request live? right here, bestie. πrqβ the request you're mapping data to. the main character, honestly. πmap_dataβ pointer to therq_map_dataholding the pages (if necessary). note the "if necessary" β it's conditional, iykyk.iterβ the iovec iterator. this is the actual user data you're feeding in. πgfp_maskβ memory allocation flags. the boring-but-load-bearing one. ngl you need these.
πΈ DESCRIPTION πΈ
okay so here's the vibe: data gets mapped directly for zero copy I/O if possible. zero copy!! we love efficiency!! π₯
but if that's not possible? a kernel bounce buffer is used instead. not the glow-up we wanted, but it's the fallback and it works. π
π¨ real talk: you must issue a matching blk_rq_unmap_user at the end of the I/O, and you gotta do it while still in process context. don't just leave it mapped and walk away, that's not the move, periodt. π
π¦ SEE ALSO π¦
- kernel file
./block/blk-map.cβ where the magic happens bio_copy_from_iter(9)bio_copy_to_iter(9)bio_uncopy_user(9)bio_copy_kern(9)blk_rq_unmap_user(9)β the one you literally cannot forget (see above β¬οΈ)blk_rq_map_kern(9)
π cute little sign-off π
this page lives down in ./block, dated October 2026, brought to you by the <rainbow>Kernel API Manual<//rainbow>. go map those iovecs, bestie β and remember the unmap. mwah πβ¨
π¦ 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