blk_mq_add_to_batch(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 where req is going. the group chat it's being added to πŸ’¬
  • is_error β€” set this to true if 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 is complete, 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 ⭐

  • true when 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:


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