blk_mq_add_to_batch(9)
π
blk_mq_add_to_batch β Kernel API Manual, bestie edition π
okay so picture this: you're in the kernel, the manual is blk_mq_add_to_batch(9), and it's giving very specific little helper energy. It does exactly one thing and it does it slayfully. Let's get into it β¨
β¨ NAME β¨
blk_mq_add_to_batch β add a request to the completion batch π«Ά
πΈ SYNOPSIS πΈ
bool blk_mq_add_to_batch (struct request *req , struct io_comp_batch
*iob , bool is_error , void (*complete)(struct io_comp_batch *) );
like yes, that's the whole signature, no cap. four things in, one bool out π
π¦ ARGUMENTS π¦
reqβ the request you're adding to the batch. the main character, honestly πiobβ the batch itself, aka wherereqis going. the group chat it's being added to π¬is_errorβ set this totrueif the request failed with an error. be honest with me, bestie πcompleteβ the completion handler for the request. (the manpage literally spells it "completaion" and honestly? iconic. we keep the energy, we just don't keep the typo in the code π the name iscomplete, always has been π )
π DESCRIPTION π
okay so the tea: batched completions only work when there is no I/O error and no special ->end_io handler.
that's it. that's the whole rule. no exception, no loophole, fr fr. if there's an error, or if something's got a special ->end_io handler going on, batching is simply not the vibe and this function will not be your girl π
lowkey important: this is a condition, not a suggestion. respect the ->end_io π«Ά
β RETURN β
truewhen the request was added to the batch β¨- otherwise
falseπ
π₯ SEE ALSO π₯
the kernel file lives at ./include/linux/blk-mq.h β go read it, it's giving lore π
and then there's the whole friend group:
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_rq_from_pdu(9)blk_mq_rq_to_pdu(9)blk_rq_nr_bvec(9)blk_rq_passthrough_stats(9)
and that's the whole page, bestie π§ this lil drop shipped straight outta ./include/linux in October 2026, and its official handle is blk_mq_add_to_batch(9) β memorize it, cite it, live it π
π¦ 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