blk_stack_limits(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– blk_stack_limits(9) πŸ’–

okay so this is a page straight out of the Kernel API Manual, and it's about blk_stack_limits β€” the little function that keeps stacked devices from having a whole identity crisis about block sizes. strap in bestie πŸŽ€


✨ NAME ✨

blk_stack_limits β€” adjust queue_limits for stacked devices πŸ¦‹


✨ SYNOPSIS ✨

int blk_stack_limits (struct queue_limits *t , struct queue_limits *b ,
sector_t start );

✨ ARGUMENTS ✨

  • t β€” the stacking driver limits πŸ’… like, this is the top device's limits, okurrr
  • b β€” the underlying queue limits, aka the bottom/component device's limits 🫢
  • start β€” the first data sector within that component device ⭐

✨ DESCRIPTION ✨

so what's the tea β˜• β€” this function is what stacking drivers like MD and DM call to make sure every single component device has compatible block sizes and alignments. no cap, that's literally the whole job.

here's the vibe: the stacking driver has to bring its own queue_limits struct (that's the top one πŸ‘‘), and then it calls the stacking function over and over, once for every bottom / component device 🧚 the stacking function then tries its absolute hardest to combine all those values and make sure everything lines up properly. it's giving matchmaker but for sectors πŸ’–


🌸 the return value, bestie 🌸

it returns 0 when the top and bottom queue_limits are compatible. slay ✨

and heads up β€” the top device's block sizes and alignment offsets may get adjusted to make sure they're aligned with the bottom device. so don't be shocked if your top limits come out looking a little different than they went in πŸ™ˆ

but if there are genuinely no compatible sizes and alignments to be found? it returns -1 😭 and the resulting top queue_limits will have the misaligned flag set β€” which is the kernel's way of saying "the alignment_offset is undefined, do not trust it, it's giving undefined behaviour energy" πŸ’€

fr fr β€” when that misaligned flag is set, the alignment_offset is undefined. that's not a vibe, that's a warning. 🚨

✨ SEE ALSO ✨

go check out the kernel file ./block/blk-settings.c and these iconic little friends 🫢:


okay that's the whole page, no notes πŸ’… this one's living in ./block, stamped October 2026, and it's blk_stack_limits(9) β€” go stack those devices responsibly bestie, ily, bye πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from