drbd_find_overlap(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… drbd_find_overlap(9) β€” the Kernel API Manual page, but make it make sense

okay so bestie, welcome to the Kernel API Manual entry for drbd_find_overlap β€” the little function that goes "hiii does anything in this tree overlap with the sector range I'm asking about?" and honestly? iconic behaviour honestly. πŸŽ€


✨ NAME ✨

drbd_find_overlap β€” search for an interval overlapping with [sector, sector + size)

like yes that's literally the whole job and she does it slayfully πŸ¦‹


🌸 SYNOPSIS 🌸

struct drbd_interval * drbd_find_overlap (struct rb_root *root ,
sector_t sector , unsigned int size );

that's the whole signature bestie, copy it exactly, do not freestyle it πŸ™ˆ


🫢 ARGUMENTS 🫢

  • root β€” red black tree root. yes the actual root of the tree, the main character of this whole situation πŸ‘‘
  • sector β€” start sector. where your search begins, the starting line, the origin story ⭐
  • size β€” size, aligned to 512 bytes. keep that alignment in mind, it's not optional vibes, it's a real requirement πŸ’…

πŸ’– DESCRIPTION πŸ’–

So here's the tea. drbd_find_overlap returns an interval overlapping with [sector, sector + size), or NULL if there is none. that's it, that's the vibe. no overlap, no interval, you get NULL, and you move on with your life 😭

lowkey important: when there is more than one overlapping interval in the tree, the interval with the lowest start sector is the one that gets returned. so she's not just returning any overlap β€” she's returning the earliest one, periodt.

and the rest of the overlapping intervals? bestie they don't get lost, okay? all other overlapping intervals will be on the right side of the tree, reachable with rb_next. so you can just keep walking with rb_next and collect every single one of them. no cap, they're all still there πŸ™Œ


πŸ‘€ SEE ALSO πŸ‘€

  • Kernel file ./drivers/block/drbd/drbd_interval.c β€” go read the source, it's giving "the receipts" πŸ”₯
  • drbd_contains_interval(9) β€” the sibling function, also worth your time, fr fr πŸ’œ

and that's the page!! 🧚 this little gem lives in ./drivers/block/drbd, dated October 2026 β€” mwah, go forth and find those overlaps bestie πŸ’…βœ¨πŸ“

πŸ“¦ where this page comes from