ENUM REQ_OP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… enum req_op β€” the kernel API manual, but make it cute

okay so bestie, this is enum req_op from the Kernel API Manual, and it's literally the blueprint for "what kind of I/O are we even doing" in the block layer. πŸŽ€


✨ NAME ✨

enum req_op β€” Operations common to the bio and request structures. We use 8 bits for encoding the operation, and the remaining 24 for flags. no cap, that's the whole bit budget right there πŸ’€


🌸 SYNOPSIS 🌸

enum req_op {
    REQ_OP_READ ,
    REQ_OP_WRITE ,
    REQ_OP_FLUSH ,
    REQ_OP_DISCARD ,
    REQ_OP_SECURE_ERASE ,
    REQ_OP_ZONE_APPEND ,
    REQ_OP_WRITE_ZEROES ,
    REQ_OP_ZONE_OPEN ,
    REQ_OP_ZONE_CLOSE ,
    REQ_OP_ZONE_FINISH ,
    REQ_OP_ZONE_RESET ,
    REQ_OP_ZONE_RESET_ALL

};

like, twelve ops, all iconic, all in order, don't touch them πŸ™ˆ


πŸ¦‹ Constants πŸ¦‹

  • REQ_OP_READ β€” read sectors from the device πŸ“–
  • REQ_OP_WRITE β€” write sectors to the device ✍️
  • REQ_OP_FLUSH β€” flush the volatile write cache 🚽 (ok not literally but the vibe is there)
  • REQ_OP_DISCARD β€” discard sectors πŸ—‘οΈ
  • REQ_OP_SECURE_ERASE β€” securely erase sectors πŸ”
  • REQ_OP_ZONE_APPEND β€” write data at the current zone write pointer πŸ“
  • REQ_OP_WRITE_ZEROES β€” write the zero filled sector many times 0️⃣0️⃣0️⃣
  • REQ_OP_ZONE_OPEN β€” Open a zone πŸ”“
  • REQ_OP_ZONE_CLOSE β€” Close a zone πŸ”’
  • REQ_OP_ZONE_FINISH β€” Transition a zone to full 🈡
  • REQ_OP_ZONE_RESET β€” reset a zone write pointer πŸ”„
  • REQ_OP_ZONE_RESET_ALL β€” reset all the zone present on the device πŸŒͺ️

πŸ’œ Description πŸ’œ

so the least significant bit of the operation number is basically the main character here β€” it tells you which way the data is flowing, iykyk:

  • if the least significant bit is set, transfers are TO the device πŸ“₯
  • if the least significant bit is not set, transfers are FROM the device πŸ“€

and if an operation does not transfer data? then the least significant bit has no meaning. it's just there, vibing, contributing nothing. we've all been there tbh πŸ’€


πŸ”₯ SEE ALSO πŸ”₯


fr fr, the whole thing lives under ./include/linux, dated October 2026, and this page is enum req_op(9). slay, go read blk_types.h bestie πŸ«Άβœ¨πŸ’–
πŸ“¦ where this page comes from