drbd_contains_interval(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– drbd_contains_interval(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual, section 9 β€” this is the page for drbd_contains_interval, and it's genuinely such a vibe. it's a little helper that just wants to know: is this interval in this tree or not? πŸŽ€ let's get into it.


✨ SYNOPSIS ✨

bool drbd_contains_interval (struct rb_root *root , sector_t sector ,
       struct drbd_interval *interval );

like, that's the whole call. it hands you back a bool and you can go about your day. πŸ¦‹


🌸 ARGUMENTS 🌸

  • root β€” the red black tree root 🌳 that's your starting point, the whole tree lives under here
  • sector β€” the start sector of the interval 🧚 you're asking about, sector_t flavoured
  • interval β€” and here's the spicy bit πŸ”₯: this one may be an invalid pointer. like, unhinged but true. it might not be a real thing at all, so don't go assuming

πŸ’… DESCRIPTION πŸ’…

so what does it actually do? it returns whether the tree contains the node interval with start sector sector. that's the whole question, that's the assignment. πŸ‘‘

and the way it's careful with interval? iconic, honestly. it does not dereference interval until interval is known to be a valid object in the tree. so it's not gonna just yolo-read from a pointer that might be garbage β€” no cap, it checks first. 🫢

one more little detail so you're not caught off guard: it returns false if interval is in the tree but with a different sector number. so like, present β‰  matching, iykyk. 😭 it's gotta be the right node and the right sector.

lowkey the moral of the story is: this function is safe to call with a sketchy interval pointer and it will not dereference it unless it's already confirmed valid in the tree. periodt. πŸ’€

🌈 SEE ALSO 🌈

  • the kernel file ./drivers/block/drbd/drbd_interval.c β€” go read the source, it's right there πŸ“‚
  • drbd_find_overlap(9) β€” the other interval bestie, go say hi ⭐

and that's the page, diva πŸ§šπŸ’œ β€” this one came to you from ./drivers/block/drbd, dated October 2026, so go forth and check your intervals with confidence. slay. πŸ’…βœ¨πŸ“

πŸ“¦ where this page comes from