raid1_check_read_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ raid1_check_read_range ✨

ok so bestie, welcome to the Kernel API Manual πŸ’… β€” today we're looking at raid1_check_read_range(9), which is genuinely one of those little helper functions that eats and leaves no crumbs πŸ“


🌸 NAME 🌸

raid1_check_read_range β€” check a given read range for bad blocks, and the available read length gets returned ✨ (yes, it says "returned;" with a semicolon, she's quirky like that, we love her)


πŸŽ€ SYNOPSIS πŸŽ€

int raid1_check_read_range (struct md_rdev *rdev , sector_t this_sector
, int *len );

like… look at that signature. iconic. no notes. πŸ‘‘


πŸ’– ARGUMENTS πŸ’–

  • rdev β€” the rdev to read 🫢 this is the device we're checking babe
  • this_sector β€” read position πŸ“ where we're at, sector-wise
  • len β€” read length πŸ“ how much we're tryna read

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this is a helper function for read_balance β€” she's not the main character, she's the bestie behind the main character, and honestly? that's main character energy too πŸ’…

here's the vibe check on what she returns πŸ‘‡

  1. If there are no bad blocks in the range, len is returned ✨ clean range, clean return, no drama
  2. If the range is all bad blocks, 0 is returned πŸ’€ nothing good in there, sorry bestie
  3. If there are partial bad blocks, we gotta get specific:
    • If the bad block range starts after this_sector, the length of the first good region is returned 🌈 yay, we found the good part
    • If the bad block range starts before this_sector, 0 is returned and len is updated to the offset into the region before we get to the good blocks 🧚 so like, len gets rewritten to tell you how far you gotta skip before the good stuff starts
no cap, case 3 is the one where you actually gotta pay attention β€” len is an int *, she gets modified, so don't be surprised when she comes back different πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/md/raid1-10.c β€” go read the source, iykyk ⭐


and that's the whole page bestie, fr fr πŸŽ€ this one lives under ./drivers/md, and the page itself is dated October 2026 β€” so yeah, she's from the future and she's still slaying πŸ’œβœ¨πŸ‘‘

πŸ“¦ where this page comes from