raid1_check_read_range(9)
β¨ 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 babethis_sectorβ read position π where we're at, sector-wiselenβ 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 π
- If there are no bad blocks in the range,
lenis returned β¨ clean range, clean return, no drama - If the range is all bad blocks,
0is returned π nothing good in there, sorry bestie - 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,0is returned andlenis updated to the offset into the region before we get to the good blocks π§ so like,lengets rewritten to tell you how far you gotta skip before the good stuff starts
- If the bad block range starts after
no cap, case 3 is the one where you actually gotta pay attention βlenis anint *, 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms