space_valid(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… space_valid(9) πŸ’…

okay so real talk, bestie β€” this one lives in the Kernel API Manual and it's called space_valid, and honestly the name is doing exactly what it says on the tin. it validates free dpa space against constraints. no cap. πŸ¦‹


✨ SYNOPSIS ✨

void space_valid (struct nd_region *nd_region , struct nvdimm_drvdata
*ndd , struct nd_label_id *label_id , struct resource *prev , struct
resource *next , struct resource *exist , resource_size_t n , struct
resource *valid );

like… that's a lot of arguments, i know, but we're gonna go through every single one together, hand in hand 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • nd_region β€” the hosting region of the free space. it's giving "where the party's at" energy.
  • ndd β€” dimm device data, but make it for debug. literally just there so you can peek at it when things go sideways πŸ’€
  • label_id β€” the namespace id that's about to get space allocated to it. main character of the allocation moment πŸ‘‘
  • prev β€” the potential allocation that comes right before the free space. front neighbor vibes.
  • next β€” the allocation that follows the given free space range. back neighbor vibes.
  • exist β€” the first allocation with the same id in the mapping. the og, the one that got there first ✨
  • n β€” the range that must be satisfied for pmem allocations. lowkey important for the pmem girlies.
  • valid β€” the free space range that we're actually validating. the whole point, honestly 🎯

🌸 DESCRIPTION 🌸

okay so here's the tea β˜•

BLK-space is valid as long as it does not precede a PMEM allocation in a given region. that's the rule, that's the whole rule, no exceptions, periodt.

PMEM-space has to be contiguous and adjacent to an existing allocation β€” but only if one exists, bestie, don't come for me. if there's no existing allocation to be adjacent to, then the adjacency requirement just isn't a thing, iykyk.

and if you're reserving PMEM? any space is valid πŸ”₯ like, go off, choose your own adventure, the constraint is not constraining you.


πŸ‘€ SEE ALSO πŸ‘€

go read those next, they're all connected, it's a whole cinematic universe fr fr 🌈


ngl this one is short but she's important β€” get the space validity wrong and your pmem allocation is not gonna have a good time 😭

and that's the page! πŸŽ€ from ./drivers/nvdimm, dated October 2026, this has been space_valid(9) β€” mwah, slay, bye bestie πŸ’œπŸ§š

πŸ“¦ where this page comes from