blk_mq_rq_from_pdu(9)
β¨ blk_mq_rq_from_pdu β¨
okay bestie, welcome to the blk_mq_rq_from_pdu(9) page from the Kernel API Manual π
this one is short and sweet and honestly kind of iconic β it's the little reverse-magic trick where you get your request back out of a PDU π
πΈ NAME πΈ
blk_mq_rq_from_pdu β cast a PDU to a request β¨
π¦ SYNOPSIS π¦
struct request * blk_mq_rq_from_pdu (void *pdu );
π ARGUMENTS π
pduβ the PDU (Protocol Data Unit) to be casted π«Ά this is the thing you're handing over so it can get turned back into a request
β RETURN β
request β that's what you get back, no cap π
π DESCRIPTION π
so here's the vibe check: driver command data is immediately after the request. literally right behind it, following it in memory π§
so to get back to the original request, you subtract the request size. that's it. that's the whole trick. math but make it slay π₯
π SEE ALSO π
- Kernel file
./include/linux/blk-mq.hπ enum blk_eh_timer_return(9)struct blk_mq_hw_ctx(9)struct blk_mq_queue_map(9)enum hctx_type(9)struct blk_mq_tag_set(9)struct blk_mq_queue_data(9)struct blk_mq_ops(9)blk_mq_rq_state(9)blk_mq_add_to_batch(9)blk_mq_rq_to_pdu(9)blk_rq_nr_bvec(9)blk_rq_passthrough_stats(9)
lowkey the whole page is like six lines and I'm obsessed with it for that π go read the friends listed above if you want the full lore, iykyk π
and that's the whole thing bestie!! π this little cutie lives in ./include/linux and the page is dated October 2026 β signed off with love by blk_mq_rq_from_pdu(9) herself π β¨π
π¦ 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